mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Using normal pointer in getInheritableMembers()
This commit is contained in:
parent
bbaa9fef6c
commit
4f13859f8c
12
AST.cpp
12
AST.cpp
@ -209,13 +209,13 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::getIn
|
||||
return *m_interfaceFunctionList;
|
||||
}
|
||||
|
||||
vector<ASTPointer<Declaration>> const& ContractDefinition::getInheritableMembers() const
|
||||
vector<Declaration const*> const& ContractDefinition::getInheritableMembers() const
|
||||
{
|
||||
if (!m_inheritableMembers)
|
||||
{
|
||||
set<string> memberSeen;
|
||||
m_inheritableMembers.reset(new vector<ASTPointer<Declaration>>());
|
||||
auto addInheritableMember = [&](ASTPointer<Declaration> const& _decl)
|
||||
m_inheritableMembers.reset(new vector<Declaration const*>());
|
||||
auto addInheritableMember = [&](Declaration const* _decl)
|
||||
{
|
||||
if (memberSeen.count(_decl->getName()) == 0 && _decl->isVisibleInDerivedContracts())
|
||||
{
|
||||
@ -225,13 +225,13 @@ vector<ASTPointer<Declaration>> const& ContractDefinition::getInheritableMembers
|
||||
};
|
||||
|
||||
for (ASTPointer<FunctionDefinition> const& f: getDefinedFunctions())
|
||||
addInheritableMember(f);
|
||||
addInheritableMember(f.get());
|
||||
|
||||
for (ASTPointer<VariableDeclaration> const& v: getStateVariables())
|
||||
addInheritableMember(v);
|
||||
addInheritableMember(v.get());
|
||||
|
||||
for (ASTPointer<StructDefinition> const& s: getDefinedStructs())
|
||||
addInheritableMember(s);
|
||||
addInheritableMember(s.get());
|
||||
}
|
||||
return *m_inheritableMembers;
|
||||
}
|
||||
|
4
AST.h
4
AST.h
@ -248,7 +248,7 @@ public:
|
||||
std::map<FixedHash<4>, FunctionTypePointer> getInterfaceFunctions() const;
|
||||
|
||||
/// @returns a list of the inheritable members of this contract
|
||||
std::vector<ASTPointer<Declaration>> const& getInheritableMembers() const;
|
||||
std::vector<Declaration const*> const& getInheritableMembers() const;
|
||||
|
||||
/// List of all (direct and indirect) base contracts in order from derived to base, including
|
||||
/// the contract itself. Available after name resolution
|
||||
@ -276,7 +276,7 @@ private:
|
||||
std::vector<ContractDefinition const*> m_linearizedBaseContracts;
|
||||
mutable std::unique_ptr<std::vector<std::pair<FixedHash<4>, FunctionTypePointer>>> m_interfaceFunctionList;
|
||||
mutable std::unique_ptr<std::vector<ASTPointer<EventDefinition>>> m_interfaceEvents;
|
||||
mutable std::unique_ptr<std::vector<ASTPointer<Declaration>>> m_inheritableMembers;
|
||||
mutable std::unique_ptr<std::vector<Declaration const*>> m_inheritableMembers;
|
||||
};
|
||||
|
||||
class InheritanceSpecifier: public ASTNode
|
||||
|
@ -1024,7 +1024,7 @@ MemberList const& TypeType::getMembers() const
|
||||
if (find(currentBases.begin(), currentBases.end(), &contract) != currentBases.end())
|
||||
// We are accessing the type of a base contract, so add all public and protected
|
||||
// members. Note that this does not add inherited functions on purpose.
|
||||
for (ASTPointer<Declaration> const& decl: contract.getInheritableMembers())
|
||||
for (Declaration const* decl: contract.getInheritableMembers())
|
||||
members.push_back(make_pair(decl->getName(), decl->getType()));
|
||||
}
|
||||
else if (m_actualType->getCategory() == Category::Enum)
|
||||
|
Loading…
Reference in New Issue
Block a user