Insert a call to panic function in legacy codegen (and not inline it every single time)

This commit is contained in:
Alex Beregszaszi
2021-05-27 18:29:46 +01:00
parent a3634934d1
commit c436785686
2 changed files with 3 additions and 8 deletions
+1 -8
View File
@@ -334,14 +334,7 @@ CompilerContext& CompilerContext::appendJump(evmasm::AssemblyItem::JumpType _jum
CompilerContext& CompilerContext::appendPanic(util::PanicCode _code)
{
Whiskers templ(R"({
mstore(0, <selector>)
mstore(4, <code>)
revert(0, 0x24)
})");
templ("selector", util::selectorFromSignature("Panic(uint256)").str());
templ("code", toCompactHexWithPrefix(static_cast<unsigned>(_code)));
appendInlineAssembly(templ.render());
callYulFunction(utilFunctions().panicFunction(_code), 0, 0);
return *this;
}