diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-28 20:43:09 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-28 21:54:15 +0800 |
commit | d5d1a08b09bec098851afc48fc0f115eac193955 (patch) | |
tree | f6b93119c1ae7934a38fbc6246af6a5fd817be64 | |
parent | aa6de494577e18dcca228df1f206e6dcbcd47902 (diff) | |
download | dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.tar dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.tar.gz dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.tar.bz2 dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.tar.lz dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.tar.xz dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.tar.zst dexon-solidity-d5d1a08b09bec098851afc48fc0f115eac193955.zip |
Pull out helper to apply address member to contract members
-rw-r--r-- | libsolidity/ast/Types.cpp | 12 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 1a9a374f..a39b5775 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1660,12 +1660,17 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con &it.second->declaration() )); } - // Add overloads from address only if there is no conflict + addNonConflictingAddressMembers(members); + return members; +} + +void ContractType::addNonConflictingAddressMembers(MemberList::MemberMap& _members) +{ MemberList::MemberMap addressMembers = IntegerType(160, IntegerType::Modifier::Address).nativeMembers(nullptr); for (auto const& addressMember: addressMembers) { bool clash = false; - for (auto const& member: members) + for (auto const& member: _members) { if ( member.name == addressMember.name && @@ -1686,13 +1691,12 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con } if (!clash) - members.push_back(MemberList::Member( + _members.push_back(MemberList::Member( addressMember.name, addressMember.type, addressMember.declaration )); } - return members; } shared_ptr<FunctionType const> const& ContractType::newExpressionType() const diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 8ba55521..ce29975e 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -716,6 +716,8 @@ public: std::vector<std::tuple<VariableDeclaration const*, u256, unsigned>> stateVariables() const; private: + static void addNonConflictingAddressMembers(MemberList::MemberMap& _members); + ContractDefinition const& m_contract; /// If true, it is the "super" type of the current contract, i.e. it contains only inherited /// members. |