mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add referencedSourceUnits() helper
This commit is contained in:
parent
1b0ef0b785
commit
a9bddf71aa
@ -84,6 +84,16 @@ SourceUnitAnnotation& SourceUnit::annotation() const
|
||||
return dynamic_cast<SourceUnitAnnotation&>(*m_annotation);
|
||||
}
|
||||
|
||||
vector<SourceUnit const*> SourceUnit::referencedSourceUnits() const
|
||||
{
|
||||
vector<SourceUnit const*> sourceUnits;
|
||||
for (ImportDirective const* importDirective: filteredNodes<ImportDirective>(nodes()))
|
||||
{
|
||||
sourceUnits.push_back(importDirective->annotation().sourceUnit);
|
||||
}
|
||||
return sourceUnits;
|
||||
}
|
||||
|
||||
SourceUnit const& Declaration::sourceUnit() const
|
||||
{
|
||||
solAssert(!!m_scope, "");
|
||||
|
@ -136,6 +136,9 @@ public:
|
||||
|
||||
std::vector<ASTPointer<ASTNode>> nodes() const { return m_nodes; }
|
||||
|
||||
/// @returns a vector of referenced SourceUnits.
|
||||
std::vector<SourceUnit const*> referencedSourceUnits() const;
|
||||
|
||||
private:
|
||||
std::vector<ASTPointer<ASTNode>> m_nodes;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user