From f5ff358addc224c598a275e134ac1d129c4edd65 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Mon, 10 Jan 2022 19:30:26 +0100 Subject: [PATCH] Adds missing accepts to ImportDirective's SymbolAlias::symbol --- libsolidity/analysis/NameAndTypeResolver.cpp | 3 ++- libsolidity/ast/AST_accept.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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); }