@@ -10,10 +10,7 @@ use swc_common::{
10
10
Mark , SyntaxContext , DUMMY_SP ,
11
11
} ;
12
12
use swc_ecma_ast:: * ;
13
- use swc_ecma_transforms_base:: {
14
- helpers:: { Helpers , HELPERS } ,
15
- perf:: { cpu_count, Parallel } ,
16
- } ;
13
+ use swc_ecma_transforms_base:: perf:: { cpu_count, Parallel } ;
17
14
use swc_ecma_utils:: {
18
15
collect_decls, find_pat_ids, parallel:: ParallelExt , ExprCtx , ExprExt , IsEmpty , ModuleItemLike ,
19
16
StmtLike , Value :: Known ,
@@ -996,31 +993,29 @@ impl VisitMut for TreeShaker {
996
993
}
997
994
998
995
fn visit_mut_module ( & mut self , m : & mut Module ) {
999
- HELPERS . set ( & Helpers :: new ( true ) , || {
1000
- let _tracing = span ! ( Level :: ERROR , "tree-shaker" , pass = self . pass) . entered ( ) ;
996
+ let _tracing = span ! ( Level :: ERROR , "tree-shaker" , pass = self . pass) . entered ( ) ;
1001
997
1002
- if self . bindings . is_empty ( ) {
1003
- self . bindings = Arc :: new ( collect_decls ( & * m) )
1004
- }
998
+ if self . bindings . is_empty ( ) {
999
+ self . bindings = Arc :: new ( collect_decls ( & * m) )
1000
+ }
1005
1001
1006
- let data: Arc < ThreadLocal < RefCell < Data > > > = Default :: default ( ) ;
1002
+ let data: Arc < ThreadLocal < RefCell < Data > > > = Default :: default ( ) ;
1007
1003
1008
- {
1009
- let mut analyzer = Analyzer {
1010
- config : & self . config ,
1011
- in_var_decl : false ,
1012
- scope : Default :: default ( ) ,
1013
- data : data. clone ( ) ,
1014
- cur_class_id : Default :: default ( ) ,
1015
- cur_fn_id : Default :: default ( ) ,
1016
- } ;
1017
- m. visit_with ( & mut analyzer) ;
1018
- }
1004
+ {
1005
+ let mut analyzer = Analyzer {
1006
+ config : & self . config ,
1007
+ in_var_decl : false ,
1008
+ scope : Default :: default ( ) ,
1009
+ data : data. clone ( ) ,
1010
+ cur_class_id : Default :: default ( ) ,
1011
+ cur_fn_id : Default :: default ( ) ,
1012
+ } ;
1013
+ m. visit_with ( & mut analyzer) ;
1014
+ }
1019
1015
1020
- self . data = Arc :: new ( merge_data ( data) ) ;
1016
+ self . data = Arc :: new ( merge_data ( data) ) ;
1021
1017
1022
- m. visit_mut_children_with ( self ) ;
1023
- } )
1018
+ m. visit_mut_children_with ( self ) ;
1024
1019
}
1025
1020
1026
1021
fn visit_mut_module_item ( & mut self , n : & mut ModuleItem ) {
@@ -1059,31 +1054,29 @@ impl VisitMut for TreeShaker {
1059
1054
}
1060
1055
1061
1056
fn visit_mut_script ( & mut self , m : & mut Script ) {
1062
- HELPERS . set ( & Helpers :: new ( true ) , || {
1063
- let _tracing = span ! ( Level :: ERROR , "tree-shaker" , pass = self . pass) . entered ( ) ;
1057
+ let _tracing = span ! ( Level :: ERROR , "tree-shaker" , pass = self . pass) . entered ( ) ;
1064
1058
1065
- if self . bindings . is_empty ( ) {
1066
- self . bindings = Arc :: new ( collect_decls ( & * m) )
1067
- }
1059
+ if self . bindings . is_empty ( ) {
1060
+ self . bindings = Arc :: new ( collect_decls ( & * m) )
1061
+ }
1068
1062
1069
- let data: Arc < ThreadLocal < RefCell < Data > > > = Default :: default ( ) ;
1063
+ let data: Arc < ThreadLocal < RefCell < Data > > > = Default :: default ( ) ;
1070
1064
1071
- {
1072
- let mut analyzer = Analyzer {
1073
- config : & self . config ,
1074
- in_var_decl : false ,
1075
- scope : Default :: default ( ) ,
1076
- data : data. clone ( ) ,
1077
- cur_class_id : Default :: default ( ) ,
1078
- cur_fn_id : Default :: default ( ) ,
1079
- } ;
1080
- m. visit_with ( & mut analyzer) ;
1081
- }
1065
+ {
1066
+ let mut analyzer = Analyzer {
1067
+ config : & self . config ,
1068
+ in_var_decl : false ,
1069
+ scope : Default :: default ( ) ,
1070
+ data : data. clone ( ) ,
1071
+ cur_class_id : Default :: default ( ) ,
1072
+ cur_fn_id : Default :: default ( ) ,
1073
+ } ;
1074
+ m. visit_with ( & mut analyzer) ;
1075
+ }
1082
1076
1083
- self . data = Arc :: new ( merge_data ( data) ) ;
1077
+ self . data = Arc :: new ( merge_data ( data) ) ;
1084
1078
1085
- m. visit_mut_children_with ( self ) ;
1086
- } )
1079
+ m. visit_mut_children_with ( self ) ;
1087
1080
}
1088
1081
1089
1082
fn visit_mut_stmt ( & mut self , s : & mut Stmt ) {
0 commit comments