From 6da10a3201b3cc7d0534d4c6b49c3371d3c246c7 Mon Sep 17 00:00:00 2001 From: anjiaqi Date: Mon, 8 Sep 2025 17:18:46 +0800 Subject: [PATCH] fix unxpected scope binding in Namespace Import Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICWY9E Signed-off-by: anjiaqi --- ets2panda/checker/ETSAnalyzer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 18f30b2681..b76671973d 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -3139,10 +3139,10 @@ checker::Type *ETSAnalyzer::Check(ir::ImportNamespaceSpecifier *st) const ES2PANDA_UNREACHABLE(); } - if (importDecl->Parent() != nullptr) { - auto topScopeCtx = varbinder::TopScopeContext(checker->VarBinder(), - importDecl->Parent()->AsETSModule()->Scope()->AsGlobalScope()); - } + auto topScopeCtx = varbinder::TopScopeContext(checker->VarBinder(), + importDecl->Parent() != nullptr + ? importDecl->Parent()->AsETSModule()->Scope()->AsGlobalScope() + : checker->VarBinder()->GetScope()->AsGlobalScope()); if (importDecl->IsPureDynamic()) { auto *type = checker->GetImportSpecifierObjectType(importDecl, st->Local()->AsIdentifier())->AsETSObjectType(); -- Gitee