mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Split fallback function and introduce "fallback()" and "receive()" syntax.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user