Address members not accessible by contract instance

This commit is contained in:
Leonardo Alt
2018-07-17 13:33:23 +01:00
parent 1d33f41c1a
commit 0075f4239a
27 changed files with 44 additions and 144 deletions
-38
View File
@@ -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)
-2
View File
@@ -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.