Add structs to inheritable members

This commit is contained in:
Lefteris Karapetsas 2015-02-26 12:11:54 +01:00
parent 5e4665b84d
commit 47177542f5
2 changed files with 8 additions and 1 deletions

View File

@ -231,6 +231,13 @@ vector<ASTPointer<Declaration>> const& ContractDefinition::getInheritableMembers
memberSeen.insert(v->getName());
m_inheritableMembers->push_back(v);
}
for (ASTPointer<StructDefinition> const& s: contract->getDefinedStructs())
if (s->isPublic() && memberSeen.count(s->getName()) == 0)
{
memberSeen.insert(s->getName());
m_inheritableMembers->push_back(s);
}
}
}
return *m_inheritableMembers;

View File

@ -1024,7 +1024,7 @@ MemberList const& TypeType::getMembers() const
vector<ContractDefinition const*> currentBases = m_currentContract->getLinearizedBaseContracts();
if (find(currentBases.begin(), currentBases.end(), &contract) != currentBases.end())
// We are accessing the type of a base contract, so add all public and protected
// functions. Note that this does not add inherited functions on purpose.
// members. Note that this does not add inherited functions on purpose.
for (ASTPointer<Declaration> const& decl: contract.getInheritableMembers())
members.push_back(make_pair(decl->getName(), decl->getType()));
}