@@ -37,7 +37,7 @@ use std::mem;
3737
3838use rustc_hash:: FxHashMap ;
3939
40- use oxc_allocator:: { Address , GetAddress , Vec as ArenaVec } ;
40+ use oxc_allocator:: { Address , Box as ArenaBox , GetAddress , Vec as ArenaVec } ;
4141use oxc_ast:: { NONE , ast:: * } ;
4242use oxc_ecmascript:: BoundNames ;
4343use oxc_semantic:: { ScopeFlags , ScopeId , SymbolFlags } ;
@@ -391,8 +391,7 @@ impl<'a> Traverse<'a> for ExplicitResourceManagement<'a, '_> {
391391 let xx = BoundIdentifier :: from_binding_ident ( class_binding)
392392 . create_read_reference ( ctx) ;
393393
394- inner_block
395- . push ( Self :: transform_class_decl ( class_decl. unbox ( ) , ctx) ) ;
394+ inner_block. push ( Self :: transform_class_decl ( class_decl, ctx) ) ;
396395
397396 let local = ModuleExportName :: IdentifierReference ( xx) ;
398397 let exported = ctx
@@ -449,7 +448,7 @@ impl<'a> Traverse<'a> for ExplicitResourceManagement<'a, '_> {
449448 ) ) ;
450449 }
451450 Statement :: ClassDeclaration ( class_decl) => {
452- inner_block. push ( Self :: transform_class_decl ( class_decl. unbox ( ) , ctx) ) ;
451+ inner_block. push ( Self :: transform_class_decl ( class_decl, ctx) ) ;
453452 }
454453 Statement :: VariableDeclaration ( ref mut var_declaration) => {
455454 if var_declaration. kind == VariableDeclarationKind :: Using {
@@ -749,7 +748,7 @@ impl<'a> ExplicitResourceManagement<'a, '_> {
749748 using_ctx : & BoundIdentifier < ' a > ,
750749 parent_scope_id : ScopeId ,
751750 ctx : & mut TraverseCtx < ' a > ,
752- ) -> CatchClause < ' a > {
751+ ) -> ArenaBox < ' a , CatchClause < ' a > > {
753752 // catch (_) { _usingCtx.e = _; }
754753 // ^ catch_parameter
755754 // ^^^^^^^^^^^^^^^^^^^^^^^^ catch_scope_id
@@ -783,7 +782,7 @@ impl<'a> ExplicitResourceManagement<'a, '_> {
783782 ) ;
784783
785784 // `catch (_) { _usingCtx.e = _; }`
786- ctx. ast . catch_clause_with_scope_id (
785+ ctx. ast . alloc_catch_clause_with_scope_id (
787786 SPAN ,
788787 Some ( catch_parameter) ,
789788 ctx. ast . block_statement_with_scope_id ( SPAN , ctx. ast . vec1 ( stmt) , block_scope_id) ,
@@ -797,7 +796,7 @@ impl<'a> ExplicitResourceManagement<'a, '_> {
797796 parent_scope_id : ScopeId ,
798797 needs_await : bool ,
799798 ctx : & mut TraverseCtx < ' a > ,
800- ) -> BlockStatement < ' a > {
799+ ) -> ArenaBox < ' a , BlockStatement < ' a > > {
801800 let finally_scope_id = ctx. create_child_scope ( parent_scope_id, ScopeFlags :: empty ( ) ) ;
802801
803802 // `_usingCtx.d()`
@@ -816,19 +815,22 @@ impl<'a> ExplicitResourceManagement<'a, '_> {
816815
817816 let stmt = if needs_await { ctx. ast . expression_await ( SPAN , expr) } else { expr } ;
818817
819- ctx. ast . block_statement_with_scope_id (
818+ ctx. ast . alloc_block_statement_with_scope_id (
820819 SPAN ,
821820 ctx. ast . vec1 ( ctx. ast . statement_expression ( SPAN , stmt) ) ,
822821 finally_scope_id,
823822 )
824823 }
825824
826825 /// `class C {}` -> `var C = class {};`
827- fn transform_class_decl ( mut class_decl : Class < ' a > , ctx : & mut TraverseCtx < ' a > ) -> Statement < ' a > {
826+ fn transform_class_decl (
827+ mut class_decl : ArenaBox < ' a , Class < ' a > > ,
828+ ctx : & mut TraverseCtx < ' a > ,
829+ ) -> Statement < ' a > {
828830 let id = class_decl. id . take ( ) . expect ( "ClassDeclaration should have an id" ) ;
829831
830832 class_decl. r#type = ClassType :: ClassExpression ;
831- let class_expr = Expression :: ClassExpression ( ctx . ast . alloc ( class_decl) ) ;
833+ let class_expr = Expression :: ClassExpression ( class_decl) ;
832834
833835 * ctx. scoping_mut ( ) . symbol_flags_mut ( id. symbol_id ( ) ) = SymbolFlags :: FunctionScopedVariable ;
834836
0 commit comments