aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ContractCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-27 20:29:04 +0800
committerchriseth <chris@ethereum.org>2017-06-29 00:00:31 +0800
commitef9a7b2144993e097da6bde7675abd5651bf64cc (patch)
treed694e8e427b3893f600f0d6d9cffd8de00d747e6 /libsolidity/codegen/ContractCompiler.cpp
parent168f64f4cb55a7055261a4c66ca54f496e96b503 (diff)
downloaddexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar
dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar.gz
dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar.bz2
dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar.lz
dexon-solidity-ef9a7b2144993e097da6bde7675abd5651bf64cc.tar.xz
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.
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.cpp')
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp10
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();