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()
|
&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);
|
MemberList::MemberMap addressMembers = IntegerType(160, IntegerType::Modifier::Address).nativeMembers(nullptr);
|
||||||
for (auto const& addressMember: addressMembers)
|
for (auto const& addressMember: addressMembers)
|
||||||
{
|
{
|
||||||
bool clash = false;
|
bool clash = false;
|
||||||
for (auto const& member: members)
|
for (auto const& member: _members)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
member.name == addressMember.name &&
|
member.name == addressMember.name &&
|
||||||
@ -1686,13 +1691,12 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!clash)
|
if (!clash)
|
||||||
members.push_back(MemberList::Member(
|
_members.push_back(MemberList::Member(
|
||||||
addressMember.name,
|
addressMember.name,
|
||||||
addressMember.type,
|
addressMember.type,
|
||||||
addressMember.declaration
|
addressMember.declaration
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return members;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<FunctionType const> const& ContractType::newExpressionType() const
|
shared_ptr<FunctionType const> const& ContractType::newExpressionType() const
|
||||||
|
@ -716,6 +716,8 @@ public:
|
|||||||
std::vector<std::tuple<VariableDeclaration const*, u256, unsigned>> stateVariables() const;
|
std::vector<std::tuple<VariableDeclaration const*, u256, unsigned>> stateVariables() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void addNonConflictingAddressMembers(MemberList::MemberMap& _members);
|
||||||
|
|
||||||
ContractDefinition const& m_contract;
|
ContractDefinition const& m_contract;
|
||||||
/// If true, it is the "super" type of the current contract, i.e. it contains only inherited
|
/// If true, it is the "super" type of the current contract, i.e. it contains only inherited
|
||||||
/// members.
|
/// members.
|
||||||
|
Loading…
Reference in New Issue
Block a user