IRGenerationContext::internalDispatch(): Fix code generated when the function called via pointer does not return anything

This commit is contained in:
Kamil Śliwak 2020-04-23 21:16:41 +02:00
parent aa071af476
commit e65a5a562e
2 changed files with 21 additions and 1 deletions

View File

@ -122,7 +122,7 @@ string IRGenerationContext::internalDispatch(size_t _in, size_t _out)
<#cases>
case <funID>
{
<out> := <name>(<in>)
<out> <assignment_op> <name>(<in>)
}
</cases>
default { invalid() }
@ -133,6 +133,7 @@ string IRGenerationContext::internalDispatch(size_t _in, size_t _out)
YulUtilFunctions utils(m_evmVersion, m_revertStrings, m_functions);
templ("in", suffixedVariableNameList("in_", 0, _in));
templ("arrow", _out > 0 ? "->" : "");
templ("assignment_op", _out > 0 ? ":=" : "");
templ("out", suffixedVariableNameList("out_", 0, _out));
vector<map<string, string>> functions;
for (auto const& contract: mostDerivedContract().annotation().linearizedBaseContracts)

View File

@ -0,0 +1,19 @@
contract test {
bool public flag = false;
function f0() public {
flag = true;
}
function f() public returns (bool) {
function() internal x = f0;
x();
return flag;
}
}
// ====
// compileViaYul: also
// ----
// f() -> true
// flag() -> true