diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 74834a0cb..968aa744c 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -571,7 +571,8 @@ bool DeclarationRegistrationHelper::visit(ImportDirective& _import) if (!m_scopes[importee]) m_scopes[importee] = make_shared(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) diff --git a/libsolidity/ast/AST_accept.h b/libsolidity/ast/AST_accept.h index 14ebfe621..fa42c2dc6 100644 --- a/libsolidity/ast/AST_accept.h +++ b/libsolidity/ast/AST_accept.h @@ -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); }