Adds missing accepts to ImportDirective's SymbolAlias::symbol

This commit is contained in:
Christian Parpart 2022-01-10 19:30:26 +01:00 committed by Marenz
parent e2fe14b0e4
commit f5ff358add
2 changed files with 10 additions and 3 deletions

View File

@ -571,7 +571,8 @@ bool DeclarationRegistrationHelper::visit(ImportDirective& _import)
if (!m_scopes[importee]) if (!m_scopes[importee])
m_scopes[importee] = make_shared<DeclarationContainer>(nullptr, m_scopes[nullptr].get()); m_scopes[importee] = make_shared<DeclarationContainer>(nullptr, m_scopes[nullptr].get());
m_scopes[&_import] = m_scopes[importee]; 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) bool DeclarationRegistrationHelper::visit(ContractDefinition& _contract)

View File

@ -58,13 +58,19 @@ void PragmaDirective::accept(ASTConstVisitor& _visitor) const
void ImportDirective::accept(ASTVisitor& _visitor) 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); _visitor.endVisit(*this);
} }
void ImportDirective::accept(ASTConstVisitor& _visitor) const 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); _visitor.endVisit(*this);
} }