diff options
author | chriseth <chris@ethereum.org> | 2018-07-19 15:24:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 15:24:27 +0800 |
commit | e3c2f20f6e8c7919a6733fa736a3a222028f213c (patch) | |
tree | 8905905bc8c29b9fc3acc08ee4f876cd8fd4ff07 /libsolidity/ast | |
parent | ccb5fccee5f7eea8993f2cbc77217abbccae36ce (diff) | |
parent | faa9c221d41c45e12411c654919f318f6e7fc98f (diff) | |
download | dexon-solidity-e3c2f20f6e8c7919a6733fa736a3a222028f213c.tar.gz dexon-solidity-e3c2f20f6e8c7919a6733fa736a3a222028f213c.tar.zst dexon-solidity-e3c2f20f6e8c7919a6733fa736a3a222028f213c.zip |
Merge pull request #4439 from ethereum/address_members
[BREAKING] Enforce address members not accessible by contract instance
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.cpp | 38 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 2 |
2 files changed, 0 insertions, 40 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index dd0736e9..2c2d3b68 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1873,47 +1873,9 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con &it.second->declaration() )); } - // In 0.5.0 address members are not populated into the contract. - if (!_contract->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050)) - 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) - { - if ( - member.name == addressMember.name && - ( - // Members with different types are not allowed - member.type->category() != addressMember.type->category() || - // Members must overload functions without clash - ( - member.type->category() == Type::Category::Function && - dynamic_cast<FunctionType const&>(*member.type).hasEqualArgumentTypes(dynamic_cast<FunctionType const&>(*addressMember.type)) - ) - ) - ) - { - clash = true; - break; - } - } - - if (!clash) - _members.push_back(MemberList::Member( - addressMember.name, - addressMember.type, - addressMember.declaration - )); - } -} - shared_ptr<FunctionType const> const& ContractType::newExpressionType() const { if (!m_constructorType) diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 135f4a0e..1a676b42 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -740,8 +740,6 @@ 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. |