diff options
author | chriseth <chris@ethereum.org> | 2017-06-27 20:29:04 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-06-29 00:00:31 +0800 |
commit | ef9a7b2144993e097da6bde7675abd5651bf64cc (patch) | |
tree | d694e8e427b3893f600f0d6d9cffd8de00d747e6 | |
parent | 168f64f4cb55a7055261a4c66ca54f496e96b503 (diff) | |
download | dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar.gz dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar.zst dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.zip |
Stack adjustment and code generation for fallback function.
This assumes that the fallback function does not have return parameters.
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 61a90050..b6352b39 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -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(); |