Split fallback function and introduce "fallback()" and "receive()" syntax.

This commit is contained in:
Daniel Kirchner
2019-11-04 17:17:58 +01:00
parent 3d625cc239
commit 3321fc56ea
137 changed files with 1340 additions and 386 deletions
+5
View File
@@ -264,6 +264,7 @@ string IRGenerator::dispatchRoutine(ContractDefinition const& _contract)
</cases>
default {}
}
if iszero(calldatasize()) { <receiveEther> }
<fallback>
)X");
t("shr224", m_utils.shiftRightFunction(224));
@@ -310,6 +311,10 @@ string IRGenerator::dispatchRoutine(ContractDefinition const& _contract)
}
else
t("fallback", "revert(0, 0)");
if (FunctionDefinition const* etherReceiver = _contract.receiveFunction())
t("receiveEther", generateFunction(*etherReceiver) + "() stop()");
else
t("receiveEther", "");
return t.render();
}