@@ -30,9 +30,9 @@ use swc_core::{
3030 common:: { FileName , Spanned , SyntaxContext } ,
3131 ecma:: visit:: swc_ecma_ast,
3232} ;
33- use swc_experimental_ecma_ast:: { Ast , ClassExpr , EsVersion , FromNodeId , Ident , NodeKind } ;
33+ use swc_experimental_ecma_ast:: { Ast , ClassExpr , EsVersion , Ident , NodeIdTrait , NodeKind } ;
3434use swc_experimental_ecma_parser:: { EsSyntax , Parser , StringSource , Syntax } ;
35- use swc_experimental_ecma_semantic:: resolver:: { Semantic , UNRESOLVED_SCOPE_ID , resolver} ;
35+ use swc_experimental_ecma_semantic:: resolver:: { Semantic , resolver} ;
3636use swc_node_comments:: SwcComments ;
3737
3838use crate :: {
@@ -2353,10 +2353,10 @@ impl ConcatenatedModule {
23532353 let semantic = resolver ( ret. root , ast) ;
23542354 let ids = collect_ident ( ast, & semantic) ;
23552355
2356- module_info. module_ctxt = SyntaxContext :: from_u32 ( semantic. top_level_scope_id ( ) . raw ( ) ) ;
2357- module_info. global_ctxt = SyntaxContext :: from_u32 ( UNRESOLVED_SCOPE_ID . raw ( ) ) ;
2356+ module_info. module_ctxt = semantic. top_level_scope_id ( ) . to_ctxt ( ) ;
2357+ module_info. global_ctxt = semantic . unresolved_scope_id ( ) . to_ctxt ( ) ;
23582358 for ident in ids {
2359- if semantic. node_scope ( ident. id ) == UNRESOLVED_SCOPE_ID {
2359+ if semantic. node_scope ( ident. id ) . to_ctxt ( ) == module_info . global_ctxt {
23602360 module_info
23612361 . global_scope_ident
23622362 . push ( ident. to_legacy ( ast, & semantic) ) ;
@@ -3229,7 +3229,7 @@ impl NewConcatenatedModuleIdent {
32293229 pub fn to_legacy ( & self , ast : & Ast , semantic : & Semantic ) -> ConcatenatedModuleIdent {
32303230 let span = self . id . span ( ast) ;
32313231 let sym = Atom :: new ( ast. get_utf8 ( self . id . sym ( ast) ) ) ;
3232- let ctxt = SyntaxContext :: from_u32 ( semantic. node_scope ( self . id ) . raw ( ) ) ;
3232+ let ctxt = semantic. node_scope ( self . id ) . to_ctxt ( ) ;
32333233 ConcatenatedModuleIdent {
32343234 id : swc_ecma_ast:: Ident :: new ( sym, span, ctxt) ,
32353235 is_class_expr_with_ident : self . is_class_expr_with_ident ,
@@ -3241,14 +3241,14 @@ impl NewConcatenatedModuleIdent {
32413241fn collect_ident ( ast : & Ast , semantic : & Semantic ) -> Vec < NewConcatenatedModuleIdent > {
32423242 let mut ids = Vec :: new ( ) ;
32433243 for ( node_id, node) in ast. nodes ( ) {
3244- if node. kind == NodeKind :: Ident {
3244+ if node. kind ( ) == NodeKind :: Ident {
32453245 let ident = Ident :: from_node_id ( node_id, ast) ;
32463246 let parent_id = semantic. parent_node ( node_id) ;
3247- let ( shorthand, is_class_expr_with_ident) = match ast. get_node ( parent_id) . kind {
3247+ let ( shorthand, is_class_expr_with_ident) = match ast. get_node ( parent_id) . kind ( ) {
32483248 NodeKind :: BindingIdent => {
32493249 let parent_id = semantic. parent_node ( parent_id) ;
32503250 (
3251- ast. get_node ( parent_id) . kind == NodeKind :: AssignPatProp ,
3251+ ast. get_node ( parent_id) . kind ( ) == NodeKind :: AssignPatProp ,
32523252 false ,
32533253 )
32543254 }
0 commit comments