aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-08-27 02:37:10 +0800
committerchriseth <c@ethdev.com>2016-09-06 03:28:28 +0800
commit962531af96a8a3ed6b28462d43c69d78fa48d511 (patch)
tree596929bcbcc12d93597067057edb3311de88af5a /libsolidity/codegen
parent680b83b2a44a8f943d6d78028ad4326f4b3b64c2 (diff)
downloaddexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.gz
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.bz2
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.lz
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.xz
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.zst
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.zip
Merged in changes from chriseth/payable
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp13
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()));