@@ -5,7 +5,6 @@ use swc_core::{
55 common:: { GLOBALS , Globals , Mark , SourceMap , errors:: Handler , sync:: Lrc , util:: take:: Take } ,
66 ecma:: {
77 ast:: { Module , Program as SwcProgram } ,
8- transforms:: base:: helpers:: { HELPERS , HelperData , Helpers } ,
98 visit:: { Fold , FoldWith , Visit , VisitMut , VisitMutWith , VisitWith } ,
109 } ,
1110} ;
@@ -73,7 +72,6 @@ impl Take for Program {
7372/// Swc transform context
7473pub struct Context {
7574 pub globals : Globals ,
76- pub helpers : HelperData ,
7775 pub top_level_mark : Mark ,
7876 pub unresolved_mark : Mark ,
7977 pub source_map : Arc < SourceMap > ,
@@ -83,13 +81,10 @@ impl Context {
8381 pub fn new ( source_map : Arc < SourceMap > , globals : Option < Globals > ) -> Self {
8482 let globals = globals. unwrap_or_default ( ) ;
8583 // generate preset mark & helpers
86- let ( top_level_mark, unresolved_mark, helpers) = GLOBALS . set ( & globals, || {
87- ( Mark :: new ( ) , Mark :: new ( ) , Helpers :: new ( true ) . data ( ) )
88- } ) ;
84+ let ( top_level_mark, unresolved_mark) = GLOBALS . set ( & globals, || ( Mark :: new ( ) , Mark :: new ( ) ) ) ;
8985
9086 Self {
9187 globals,
92- helpers,
9388 top_level_mark,
9489 unresolved_mark,
9590 source_map,
@@ -100,7 +95,6 @@ impl Context {
10095impl std:: fmt:: Debug for Context {
10196 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
10297 f. debug_struct ( "Context" )
103- . field ( "helpers" , & self . helpers )
10498 . field ( "top_level_mark" , & self . top_level_mark )
10599 . field ( "unresolved_mark" , & self . unresolved_mark )
106100 . finish ( )
@@ -163,9 +157,7 @@ impl Ast {
163157 F : FnOnce ( & mut Program , & Context ) -> R ,
164158 {
165159 let Self { program, context } = self ;
166- GLOBALS . set ( & context. globals , || {
167- HELPERS . set ( & Helpers :: from_data ( context. helpers ) , || f ( program, context) )
168- } )
160+ GLOBALS . set ( & context. globals , || f ( program, context) )
169161 }
170162
171163 pub fn transform_with_handler < F , R > ( & mut self , cm : Lrc < SourceMap > , f : F ) -> Result < R , BatchErrors >
@@ -184,8 +176,6 @@ impl Ast {
184176 F : FnOnce ( & Program , & Context ) -> R ,
185177 {
186178 let Self { program, context } = self ;
187- GLOBALS . set ( & context. globals , || {
188- HELPERS . set ( & Helpers :: from_data ( context. helpers ) , || f ( program, context) )
189- } )
179+ GLOBALS . set ( & context. globals , || f ( program, context) )
190180 }
191181}
0 commit comments