@@ -31,6 +31,7 @@ mod es2019;
31
31
mod es2020;
32
32
mod es2021;
33
33
mod es2022;
34
+ mod es2026;
34
35
mod jsx;
35
36
mod proposals;
36
37
mod regexp;
@@ -50,8 +51,8 @@ use es2019::ES2019;
50
51
use es2020:: ES2020 ;
51
52
use es2021:: ES2021 ;
52
53
use es2022:: ES2022 ;
54
+ use es2026:: ES2026 ;
53
55
use jsx:: Jsx ;
54
- use proposals:: ExplicitResourceManagement ;
55
56
use regexp:: RegExp ;
56
57
use rustc_hash:: FxHashMap ;
57
58
use state:: TransformState ;
@@ -70,6 +71,7 @@ pub use crate::{
70
71
es2020:: ES2020Options ,
71
72
es2021:: ES2021Options ,
72
73
es2022:: { ClassPropertiesOptions , ES2022Options } ,
74
+ es2026:: ES2026Options ,
73
75
jsx:: { JsxOptions , JsxRuntime , ReactRefreshOptions } ,
74
76
options:: {
75
77
ESTarget , Engine , EngineTargets , EnvOptions , Module , TransformOptions ,
@@ -98,6 +100,7 @@ pub struct Transformer<'a> {
98
100
plugins : PluginsOptions ,
99
101
jsx : JsxOptions ,
100
102
env : EnvOptions ,
103
+ #[ expect( dead_code) ]
101
104
proposals : ProposalOptions ,
102
105
}
103
106
@@ -140,15 +143,12 @@ impl<'a> Transformer<'a> {
140
143
common : Common :: new ( & self . env , & self . ctx ) ,
141
144
decorator : Decorator :: new ( self . decorator , & self . ctx ) ,
142
145
plugins : Plugins :: new ( self . plugins , & self . ctx ) ,
143
- explicit_resource_management : self
144
- . proposals
145
- . explicit_resource_management
146
- . then ( || ExplicitResourceManagement :: new ( & self . ctx ) ) ,
147
146
x0_typescript : program
148
147
. source_type
149
148
. is_typescript ( )
150
149
. then ( || TypeScript :: new ( & self . typescript , & self . ctx ) ) ,
151
150
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 ) ,
152
152
x2_es2022 : ES2022 :: new (
153
153
self . env . es2022 ,
154
154
!self . typescript . allow_declare_fields
@@ -178,8 +178,8 @@ struct TransformerImpl<'a, 'ctx> {
178
178
x0_typescript : Option < TypeScript < ' a , ' ctx > > ,
179
179
decorator : Decorator < ' a , ' ctx > ,
180
180
plugins : Plugins < ' a , ' ctx > ,
181
- explicit_resource_management : Option < ExplicitResourceManagement < ' a , ' ctx > > ,
182
181
x1_jsx : Jsx < ' a , ' ctx > ,
182
+ x2_es2026 : ES2026 < ' a , ' ctx > ,
183
183
x2_es2022 : ES2022 < ' a , ' ctx > ,
184
184
x2_es2021 : ES2021 < ' a , ' ctx > ,
185
185
x2_es2020 : ES2020 < ' a , ' ctx > ,
@@ -200,9 +200,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
200
200
}
201
201
self . plugins . enter_program ( program, ctx) ;
202
202
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) ;
206
204
}
207
205
208
206
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, '_> {
316
314
317
315
fn exit_static_block ( & mut self , block : & mut StaticBlock < ' a > , ctx : & mut TraverseCtx < ' a > ) {
318
316
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) ;
322
318
self . x2_es2022 . exit_static_block ( block, ctx) ;
323
319
}
324
320
@@ -409,9 +405,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
409
405
410
406
fn enter_function_body ( & mut self , body : & mut FunctionBody < ' a > , ctx : & mut TraverseCtx < ' a > ) {
411
407
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) ;
415
409
}
416
410
417
411
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, '_> {
603
597
typescript. enter_statement ( stmt, ctx) ;
604
598
}
605
599
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) ;
609
601
}
610
602
611
603
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, '_> {
646
638
if let Some ( typescript) = self . x0_typescript . as_mut ( ) {
647
639
typescript. enter_for_of_statement ( stmt, ctx) ;
648
640
}
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) ;
652
642
self . x2_es2018 . enter_for_of_statement ( stmt, ctx) ;
653
643
}
654
644
@@ -660,9 +650,7 @@ impl<'a> Traverse<'a, TransformState<'a>> for TransformerImpl<'a, '_> {
660
650
}
661
651
662
652
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) ;
666
654
}
667
655
668
656
fn enter_catch_clause ( & mut self , clause : & mut CatchClause < ' a > , ctx : & mut TraverseCtx < ' a > ) {
0 commit comments