Merge pull request #12494 from ethereum/AST-ImportDirective-traversal-fix

Adds missing accepts to ImportDirective's SymbolAlias::symbol.
This commit is contained in:
Mathias L. Baumann 2022-01-24 13:27:00 +01:00 committed by GitHub
commit b6dbfdf79b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -571,7 +571,8 @@ bool DeclarationRegistrationHelper::visit(ImportDirective& _import)
if (!m_scopes[importee])
m_scopes[importee] = make_shared<DeclarationContainer>(nullptr, m_scopes[nullptr].get());
m_scopes[&_import] = m_scopes[importee];
return ASTVisitor::visit(_import);
ASTVisitor::visit(_import);
return false; // Do not recurse into child nodes (Identifier for symbolAliases)
}
bool DeclarationRegistrationHelper::visit(ContractDefinition& _contract)

View File

@ -58,13 +58,19 @@ void PragmaDirective::accept(ASTConstVisitor& _visitor) const
void ImportDirective::accept(ASTVisitor& _visitor)
{
_visitor.visit(*this);
if (_visitor.visit(*this))
for (SymbolAlias const& symbolAlias: symbolAliases())
if (symbolAlias.symbol)
symbolAlias.symbol->accept(_visitor);
_visitor.endVisit(*this);
}
void ImportDirective::accept(ASTConstVisitor& _visitor) const
{
_visitor.visit(*this);
if (_visitor.visit(*this))
for (SymbolAlias const& symbolAlias: symbolAliases())
if (symbolAlias.symbol)
symbolAlias.symbol->accept(_visitor);
_visitor.endVisit(*this);
}