diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 18f30b2681dcedcc830305bab68e08c59fce5ebd..b76671973da0ac77796213662fd15512f670b9c0 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();