aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-09-13 23:30:54 +0800
committerGitHub <noreply@github.com>2018-09-13 23:30:54 +0800
commite7daed68c1977683546ac3e72d4f84ff538f6711 (patch)
treebb2595e6cc12d420c22bc0373bcb5a7f81c3b0bb /libsolidity/codegen/ExpressionCompiler.cpp
parent5aa5fa78f32c89fcf8f635db026d18a6ba8ef132 (diff)
parentae35a58124852eda9a5e6bf67f9976198d2f9c0f (diff)
downloaddexon-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.cpp17
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