diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-08-27 02:37:10 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-09-06 03:28:28 +0800 |
commit | 962531af96a8a3ed6b28462d43c69d78fa48d511 (patch) | |
tree | 596929bcbcc12d93597067057edb3311de88af5a /libsolidity/codegen/ContractCompiler.cpp | |
parent | 680b83b2a44a8f943d6d78028ad4326f4b3b64c2 (diff) | |
download | dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.gz dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.zst dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.zip |
Merged in changes from chriseth/payable
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index eba85103..58e6847c 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -243,14 +243,6 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac if (fallback) { eth::AssemblyItem returnTag = m_context.pushNewTag(); - - // Reject transaction if value is not accepted, but was received - if (!fallback->isPayable()) - { - m_context << Instruction::CALLVALUE; - m_context.appendConditionalJumpTo(m_context.errorTag()); - } - fallback->accept(*this); m_context << returnTag; appendReturnValuePacker(FunctionType(*fallback).returnParameterTypes(), _contract.isLibrary()); @@ -265,15 +257,14 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac CompilerContext::LocationSetter locationSetter(m_context, functionType->declaration()); m_context << callDataUnpackerEntryPoints.at(it.first); - eth::AssemblyItem returnTag = m_context.pushNewTag(); - - // Reject transaction if value is not accepted, but was received if (!functionType->isPayable()) { + // Throw if function is not payable but call contained ether. m_context << Instruction::CALLVALUE; m_context.appendConditionalJumpTo(m_context.errorTag()); } + eth::AssemblyItem returnTag = m_context.pushNewTag(); m_context << CompilerUtils::dataStartOffset; appendCalldataUnpacker(functionType->parameterTypes()); m_context.appendJumpTo(m_context.functionEntryLabel(functionType->declaration())); |