mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Stack adjustment and code generation for fallback function.
This assumes that the fallback function does not have return parameters.
This commit is contained in:
parent
168f64f4cb
commit
ef9a7b2144
@ -271,13 +271,15 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac
|
||||
if (!fallback->isPayable())
|
||||
appendCallValueCheck();
|
||||
|
||||
// Return tag is used to jump out of the function.
|
||||
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
||||
fallback->accept(*this);
|
||||
m_context << returnTag;
|
||||
m_context.adjustStackOffset(
|
||||
CompilerUtils(m_context).sizeOnStack(FunctionType(*fallback).returnParameterTypes()) - 1
|
||||
);
|
||||
appendReturnValuePacker(FunctionType(*fallback).returnParameterTypes(), _contract.isLibrary());
|
||||
solAssert(FunctionType(*fallback).parameterTypes().empty(), "");
|
||||
solAssert(FunctionType(*fallback).returnParameterTypes().empty(), "");
|
||||
// Return tag gets consumed.
|
||||
m_context.adjustStackOffset(-1);
|
||||
m_context << Instruction::STOP;
|
||||
}
|
||||
else
|
||||
m_context.appendRevert();
|
||||
|
Loading…
Reference in New Issue
Block a user