diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-05-26 21:05:58 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-06-01 19:06:12 +0800 |
commit | e72a014cf44d086f3cb12bf1f4e2cfa02d781d38 (patch) | |
tree | 24d82fd9f75ac4d23e9d6eecbfb38c136f0088af | |
parent | ce6126094ac0aa6f6eb8158d10534079021a90b9 (diff) | |
download | dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.tar dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.tar.gz dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.tar.bz2 dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.tar.lz dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.tar.xz dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.tar.zst dexon-solidity-e72a014cf44d086f3cb12bf1f4e2cfa02d781d38.zip |
special handle of send
-rw-r--r-- | ExpressionCompiler.cpp | 18 | ||||
-rw-r--r-- | ExpressionCompiler.h | 3 |
2 files changed, 15 insertions, 6 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index ae8bcaee..e8ac8ff8 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -534,7 +534,8 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) true, true ), - {} + {}, + true ); break; case Location::Suicide: @@ -1034,8 +1035,8 @@ void ExpressionCompiler::appendHighBitsCleanup(IntegerType const& _typeOnStack) void ExpressionCompiler::appendExternalFunctionCall( FunctionType const& _functionType, - vector<ASTPointer<Expression const>> const& _arguments -) + vector<ASTPointer<Expression const>> const& _arguments, + bool isSend) { solAssert(_functionType.takesArbitraryParameters() || _arguments.size() == _functionType.getParameterTypes().size(), ""); @@ -1105,8 +1106,15 @@ void ExpressionCompiler::appendExternalFunctionCall( m_context << eth::Instruction::CALL; //Propagate error condition (if CALL pushes 0 on stack). - m_context << eth::Instruction::ISZERO; - m_context.appendConditionalJumpTo(m_context.errorTag()); + if (!isSend) + { + m_context << eth::Instruction::ISZERO; + m_context.appendConditionalJumpTo(m_context.errorTag()); + } else + { + auto tag = m_context.appendConditionalJump(); + m_context << eth::Instruction::STOP << tag; + } if (_functionType.valueSet()) m_context << eth::Instruction::POP; diff --git a/ExpressionCompiler.h b/ExpressionCompiler.h index 954e32c8..6f47762b 100644 --- a/ExpressionCompiler.h +++ b/ExpressionCompiler.h @@ -100,7 +100,8 @@ private: /// Appends code to call a function of the given type with the given arguments. void appendExternalFunctionCall( FunctionType const& _functionType, - std::vector<ASTPointer<Expression const>> const& _arguments + std::vector<ASTPointer<Expression const>> const& _arguments, + bool isSend = false ); /// Appends code that evaluates the given arguments and moves the result to memory encoded as /// specified by the ABI. The memory offset is expected to be on the stack and is updated by |