File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,9 +43,8 @@ impl Chunk {
4343 . iter ( )
4444 . flat_map ( |part| part. declared_symbols . iter ( ) . copied ( ) ) ,
4545 )
46- . for_each ( |symbol_id| {
47- let canonical_ref =
48- graph. symbols . par_get_canonical_ref ( ( module. id , symbol_id) . into ( ) ) ;
46+ . for_each ( |symbol_ref| {
47+ let canonical_ref = graph. symbols . par_get_canonical_ref ( symbol_ref) ;
4948
5049 let original_name = graph. symbols . get_original_name ( canonical_ref) ;
5150
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ impl NormalModule {
103103 if !self_linker_module. is_symbol_for_namespace_referenced {
104104 self_linker_module. is_symbol_for_namespace_referenced = true ;
105105 self_linker_module. virtual_stmt_infos . push ( VirtualStmtInfo {
106- declared_symbols : vec ! [ self . namespace_symbol. symbol ] ,
106+ declared_symbols : vec ! [ self . namespace_symbol] ,
107107 ..Default :: default ( )
108108 } ) ;
109109 }
@@ -335,9 +335,10 @@ impl NormalModule {
335335 . into ( ) ;
336336 let symbol = symbols. create_symbol ( self . id , name) . symbol ;
337337 self_linker_module. wrap_symbol = Some ( ( self . id , symbol) . into ( ) ) ;
338- self_linker_module
339- . virtual_stmt_infos
340- . push ( VirtualStmtInfo { declared_symbols : vec ! [ symbol] , ..Default :: default ( ) } ) ;
338+ self_linker_module. virtual_stmt_infos . push ( VirtualStmtInfo {
339+ declared_symbols : vec ! [ ( self . id, symbol) . into( ) ] ,
340+ ..Default :: default ( )
341+ } ) ;
341342 self . initialize_namespace ( self_linker_module) ;
342343 }
343344 }
@@ -365,7 +366,7 @@ impl NormalModule {
365366 // FIXME: should store the symbol in `used_symbols` instead of `declared_symbols`.
366367 // The deconflict for runtime symbols would be handled in the deconflict on cross-chunk-imported
367368 // symbols
368- declared_symbols : vec ! [ local_symbol_ref. symbol ] ,
369+ declared_symbols : vec ! [ local_symbol_ref] ,
369370 ..Default :: default ( )
370371 } ) ;
371372 local_symbol_ref
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ impl<'a> Scanner<'a> {
8989 }
9090
9191 fn add_declared_id ( & mut self , id : SymbolId ) {
92- self . current_stmt_info . declared_symbols . push ( id ) ;
92+ self . current_stmt_info . declared_symbols . push ( ( self . idx , id ) . into ( ) ) ;
9393 }
9494
9595 fn get_root_binding ( & self , name : & Atom ) -> SymbolId {
@@ -203,7 +203,7 @@ impl<'a> Scanner<'a> {
203203 oxc:: ast:: ast:: Declaration :: FunctionDeclaration ( fn_decl) => {
204204 let id = fn_decl. id . as_ref ( ) . unwrap ( ) ;
205205 // FIXME: remove this line after https://github.com/web-infra-dev/oxc/pull/843 being merged.
206- self . current_stmt_info . declared_symbols . push ( id. expect_symbol_id ( ) ) ;
206+ self . add_declared_id ( id. expect_symbol_id ( ) ) ;
207207 self . add_local_export ( & id. name , id. expect_symbol_id ( ) ) ;
208208 }
209209 oxc:: ast:: ast:: Declaration :: ClassDeclaration ( cls_decl) => {
@@ -247,8 +247,7 @@ impl<'a> Scanner<'a> {
247247 SymbolFlags :: None ,
248248 self . scope . root_scope_id ( ) ,
249249 ) ;
250-
251- self . current_stmt_info . declared_symbols . push ( sym_id) ;
250+ self . add_declared_id ( sym_id) ;
252251 sym_id
253252 } ) ;
254253 self . add_local_default_export ( local) ;
Original file line number Diff line number Diff line change 1- use oxc:: semantic:: SymbolId ;
2-
31use crate :: SymbolRef ;
42
53index_vec:: define_index_type! {
@@ -10,7 +8,7 @@ index_vec::define_index_type! {
108pub struct StmtInfo {
119 pub stmt_idx : usize ,
1210 // currently, we only store top level symbols
13- pub declared_symbols : Vec < SymbolId > ,
11+ pub declared_symbols : Vec < SymbolRef > ,
1412 // We will add symbols of other modules to `referenced_symbols`, so we need `SymbolRef`
1513 // here instead of `SymbolId`.
1614 /// Top level symbols referenced by this statement.
@@ -20,6 +18,6 @@ pub struct StmtInfo {
2018// Because we want declare symbols at linker, it shouldn't mutate the original `StmtInfo`.
2119#[ derive( Default , Debug ) ]
2220pub struct VirtualStmtInfo {
23- pub declared_symbols : Vec < SymbolId > ,
21+ pub declared_symbols : Vec < SymbolRef > ,
2422 pub referenced_symbols : Vec < SymbolRef > ,
2523}
You can’t perform that action at this time.
0 commit comments