Merge pull request #8764 from ethereum/sol-yul-fix-pointers-to-functions-returning-nothing

[Sol->Yul] Fix pointers to functions returning nothing
This commit is contained in:
chriseth 2020-04-24 00:35:48 +02:00 committed by GitHub
commit 989d1da43c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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