diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-09-13 23:30:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-13 23:30:54 +0800 |
commit | e7daed68c1977683546ac3e72d4f84ff538f6711 (patch) | |
tree | bb2595e6cc12d420c22bc0373bcb5a7f81c3b0bb /libsolidity/codegen/ExpressionCompiler.cpp | |
parent | 5aa5fa78f32c89fcf8f635db026d18a6ba8ef132 (diff) | |
parent | ae35a58124852eda9a5e6bf67f9976198d2f9c0f (diff) | |
download | dexon-solidity-e7daed68c1977683546ac3e72d4f84ff538f6711.tar.gz dexon-solidity-e7daed68c1977683546ac3e72d4f84ff538f6711.tar.zst dexon-solidity-e7daed68c1977683546ac3e72d4f84ff538f6711.zip |
Merge pull request #4911 from ethereum/addressPayable
Payable and non-payable address type.
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 45e58bd0..bd863e05 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1259,7 +1259,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) identifier = FunctionType(*function).externalIdentifier(); else solAssert(false, "Contract member is neither variable nor function."); - utils().convertType(type, AddressType(), true); + utils().convertType(type, AddressType(type.isPayable() ? StateMutability::Payable : StateMutability::NonPayable), true); m_context << identifier; } else @@ -1277,15 +1277,24 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) { utils().convertType( *_memberAccess.expression().annotation().type, - AddressType(), + AddressType(StateMutability::NonPayable), true ); m_context << Instruction::BALANCE; } - else if ((set<string>{"send", "transfer", "call", "callcode", "delegatecall", "staticcall"}).count(member)) + else if ((set<string>{"send", "transfer"}).count(member)) + { + solAssert(dynamic_cast<AddressType const&>(*_memberAccess.expression().annotation().type).stateMutability() == StateMutability::Payable, ""); + utils().convertType( + *_memberAccess.expression().annotation().type, + AddressType(StateMutability::Payable), + true + ); + } + else if ((set<string>{"call", "callcode", "delegatecall", "staticcall"}).count(member)) utils().convertType( *_memberAccess.expression().annotation().type, - AddressType(), + AddressType(StateMutability::NonPayable), true ); else |