aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-02-24 22:42:52 +0800
committerGitHub <noreply@github.com>2017-02-24 22:42:52 +0800
commit673268a6f8345e9276764f13e105869f5be92adc (patch)
tree24fca84a746ec5b56d97070529212b1c76f114bb /libsolidity/codegen/ExpressionCompiler.cpp
parentbec3c6fab6bf02aea5664be4423f45e98db22e8e (diff)
parent4d290e551c2d563671f9d56744883d3f3dff98ec (diff)
downloaddexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.tar
dexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.tar.gz
dexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.tar.bz2
dexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.tar.lz
dexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.tar.xz
dexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.tar.zst
dexon-solidity-673268a6f8345e9276764f13e105869f5be92adc.zip
Merge pull request #1651 from ethereum/transfer-method
Add address.transfer(value)
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 2ed19a83..fd4d87a5 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -616,6 +616,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
arguments.front()->accept(*this);
break;
case Location::Send:
+ case Location::Transfer:
_functionCall.expression().accept(*this);
// Provide the gas stipend manually at first because we may send zero ether.
// Will be zeroed if we send more than zero ether.
@@ -644,6 +645,12 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
),
{}
);
+ if (function.location() == Location::Transfer)
+ {
+ // Check if zero (out of stack or not enough balance).
+ m_context << Instruction::ISZERO;
+ m_context.appendConditionalInvalid();
+ }
break;
case Location::Selfdestruct:
arguments.front()->accept(*this);
@@ -960,6 +967,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
case FunctionType::Location::Bare:
case FunctionType::Location::BareCallCode:
case FunctionType::Location::BareDelegateCall:
+ case FunctionType::Location::Transfer:
_memberAccess.expression().accept(*this);
m_context << funType->externalIdentifier();
break;
@@ -1041,7 +1049,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
);
m_context << Instruction::BALANCE;
}
- else if ((set<string>{"send", "call", "callcode", "delegatecall"}).count(member))
+ else if ((set<string>{"send", "transfer", "call", "callcode", "delegatecall"}).count(member))
utils().convertType(
*_memberAccess.expression().annotation().type,
IntegerType(0, IntegerType::Modifier::Address),