@@ -31,6 +31,7 @@ mod es2019;
3131mod es2020;
3232mod es2021;
3333mod es2022;
34+ mod es2026;
3435mod jsx;
3536mod proposals;
3637mod regexp;
@@ -50,8 +51,8 @@ use es2019::ES2019;
5051use es2020:: ES2020 ;
5152use es2021:: ES2021 ;
5253use es2022:: ES2022 ;
54+ use es2026:: ES2026 ;
5355use jsx:: Jsx ;
54- use proposals:: ExplicitResourceManagement ;
5556use regexp:: RegExp ;
5657use rustc_hash:: FxHashMap ;
5758use state:: TransformState ;
@@ -70,6 +71,7 @@ pub use crate::{
7071 es2020:: ES2020Options ,
7172 es2021:: ES2021Options ,
7273 es2022:: { ClassPropertiesOptions , ES2022Options } ,
74+ es2026:: ES2026Options ,
7375 jsx:: { JsxOptions , JsxRuntime , ReactRefreshOptions } ,
7476 options:: {
7577 ESTarget , Engine , EngineTargets , EnvOptions , Module , TransformOptions ,
@@ -98,6 +100,7 @@ pub struct Transformer<'a> {
98100 plugins : PluginsOptions ,
99101 jsx : JsxOptions ,
100102 env : EnvOptions ,
103+ #[ expect( dead_code) ]
101104 proposals : ProposalOptions ,
102105}
103106
@@ -140,15 +143,12 @@ impl<'a> Transformer<'a> {
140143 common : Common :: new ( & self . env , & self . ctx ) ,
141144 decorator : Decorator :: new ( self . decorator , & self . ctx ) ,
142145 plugins : Plugins :: new ( self . plugins , & self . ctx ) ,
143- explicit_resource_management : self
144- . proposals
145- . explicit_resource_management
146- . then ( || ExplicitResourceManagement :: new ( & self . ctx ) ) ,
147146 x0_typescript : program
148147 . source_type
149148 . is_typescript ( )
150149 . then ( || TypeScript :: new ( & self . typescript , & self . ctx ) ) ,
151150 x1_jsx : Jsx :: new ( self . jsx , self . env . es2018 . object_rest_spread , ast_builder, & self . ctx ) ,
151+ x2_es2026 : ES2026 :: new ( self . env . es2026 , & self . ctx ) ,
152152 x2_es2022 : ES2022 :: new (
153153 self . env . es2022 ,
154154 !self . typescript . allow_declare_fields
@@ -178,8 +178,8 @@ struct TransformerImpl<'a, 'ctx> {
178178 x0_typescript : Option < TypeScript < ' a , ' ctx > > ,
179179 decorator : Decorator < ' a , ' ctx > ,
180180 plugins : Plugins < ' a , ' ctx > ,
181- explicit_resource_management : Option < ExplicitResourceManagement < ' a , ' ctx > > ,
182181 x1_jsx : Jsx < ' a , ' ctx > ,
182+ x2_es2026 : ES2026 < ' a , ' ctx > ,
183183 x2_es2022 : ES2022 < ' a , ' ctx > ,
184184 x2_es2021 : ES2021 < ' a , ' ctx > ,
185185 x2_es2020 : ES2020 < ' a , ' ctx > ,
@@ -200,9 +200,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
200200 }
201201 self . plugins . enter_program ( program, ctx) ;
202202 self . x1_jsx . enter_program ( program, ctx) ;
203- if let Some ( explicit_resource_management) = self . explicit_resource_management . as_mut ( ) {
204- explicit_resource_management. enter_program ( program, ctx) ;
205- }
203+ self . x2_es2026 . enter_program ( program, ctx) ;
206204 }
207205
208206 fn exit_program ( & mut self , program : & mut Program < ' a > , ctx : & mut TraverseCtx < ' a > ) {
@@ -316,9 +314,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
316314
317315 fn exit_static_block ( & mut self , block : & mut StaticBlock < ' a > , ctx : & mut TraverseCtx < ' a > ) {
318316 self . common . exit_static_block ( block, ctx) ;
319- if let Some ( explicit_resource_management) = self . explicit_resource_management . as_mut ( ) {
320- explicit_resource_management. exit_static_block ( block, ctx) ;
321- }
317+ self . x2_es2026 . exit_static_block ( block, ctx) ;
322318 self . x2_es2022 . exit_static_block ( block, ctx) ;
323319 }
324320
@@ -409,9 +405,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
409405
410406 fn enter_function_body ( & mut self , body : & mut FunctionBody < ' a > , ctx : & mut TraverseCtx < ' a > ) {
411407 self . common . enter_function_body ( body, ctx) ;
412- if let Some ( explicit_resource_management) = self . explicit_resource_management . as_mut ( ) {
413- explicit_resource_management. enter_function_body ( body, ctx) ;
414- }
408+ self . x2_es2026 . enter_function_body ( body, ctx) ;
415409 }
416410
417411 fn exit_function_body ( & mut self , body : & mut FunctionBody < ' a > , ctx : & mut TraverseCtx < ' a > ) {
@@ -603,9 +597,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
603597 typescript. enter_statement ( stmt, ctx) ;
604598 }
605599 self . x2_es2018 . enter_statement ( stmt, ctx) ;
606- if let Some ( explicit_resource_management) = self . explicit_resource_management . as_mut ( ) {
607- explicit_resource_management. enter_statement ( stmt, ctx) ;
608- }
600+ self . x2_es2026 . enter_statement ( stmt, ctx) ;
609601 }
610602
611603 fn enter_declaration ( & mut self , decl : & mut Declaration < ' a > , ctx : & mut TraverseCtx < ' a > ) {
@@ -646,9 +638,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
646638 if let Some ( typescript) = self . x0_typescript . as_mut ( ) {
647639 typescript. enter_for_of_statement ( stmt, ctx) ;
648640 }
649- if let Some ( explicit_resource_management) = self . explicit_resource_management . as_mut ( ) {
650- explicit_resource_management. enter_for_of_statement ( stmt, ctx) ;
651- }
641+ self . x2_es2026 . enter_for_of_statement ( stmt, ctx) ;
652642 self . x2_es2018 . enter_for_of_statement ( stmt, ctx) ;
653643 }
654644
@@ -660,9 +650,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
660650 }
661651
662652 fn enter_try_statement ( & mut self , stmt : & mut TryStatement < ' a > , ctx : & mut TraverseCtx < ' a > ) {
663- if let Some ( explicit_resource_management) = self . explicit_resource_management . as_mut ( ) {
664- explicit_resource_management. enter_try_statement ( stmt, ctx) ;
665- }
653+ self . x2_es2026 . enter_try_statement ( stmt, ctx) ;
666654 }
667655
668656 fn enter_catch_clause ( & mut self , clause : & mut CatchClause < ' a > , ctx : & mut TraverseCtx < ' a > ) {
0 commit comments