mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Pull out helper to apply address member to contract members
This commit is contained in:
parent
aa6de49457
commit
d5d1a08b09
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user