refactor(ast_visit, isolated_declarations, minifier, transformer): pass array literals for from_array_in builder args#24624
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
702b234 to
6b23ad7
Compare
6644623 to
02916f6
Compare
There was a problem hiding this comment.
Pull request overview
Refactors AST builder call sites across the transformer, minifier, isolated declarations, and ast_visit crates to use array literals directly for parameters that accept IntoIn<'a, ArenaVec<...>>, removing redundant ArenaVec::from_array_in(...) wrappers introduced by earlier builder API updates.
Changes:
- Replace inline
ArenaVec::from_array_in([...], ctx)arguments at AST builder call sites with direct array literals ([...]). - Simplify some intermediate locals (e.g., sequence expressions) by inlining the new array-based arguments.
- Clean up unused
ArenaVecimports where the type is no longer referenced in the file.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_transformer/src/regexp/mod.rs | Pass arguments as an array literal to new_new_expression; remove unused ArenaVec import. |
| crates/oxc_transformer/src/jsx/refresh.rs | Pass call arguments as an array literal for the refresh registration call. |
| crates/oxc_transformer/src/jsx/jsx_source.rs | Build object expression properties via array literal; remove unused ArenaVec import. |
| crates/oxc_transformer/src/es2022/class_properties/super_converter.rs | Use array literals for new_sequence_expression expression lists. |
| crates/oxc_transformer/src/es2022/class_properties/prop_decl.rs | Use array literal for object expression property list in prop_def. |
| crates/oxc_transformer/src/es2022/class_properties/private_field.rs | Use array literals for several sequence/array expression element lists. |
| crates/oxc_transformer/src/es2020/optional_chaining.rs | Use array literal for sequence expression; remove unused ArenaVec import. |
| crates/oxc_transformer/src/es2018/async_generator_functions/for_await.rs | Use array literals for declarator lists and block statement bodies. |
| crates/oxc_transformer/src/es2017/async_to_generator.rs | Pass function body statements as an array literal to FunctionBody::boxed. |
| crates/oxc_transformer/src/common/arrow_function_converter.rs | Use array literal for a sequence expression during replacement. |
| crates/oxc_transformer_plugins/src/module_runner_transform.rs | Use array literals for sequence expression and object property list construction. |
| crates/oxc_minifier/src/peephole/substitute_alternate_syntax.rs | Use array literal for sequence expression expressions list. |
| crates/oxc_minifier/src/peephole/remove_unused_expression.rs | Use array literal for sequence expression expressions list. |
| crates/oxc_minifier/src/peephole/remove_dead_code.rs | Inline sequence expression construction with array literals (removes temporary ArenaVec). |
| crates/oxc_minifier/src/peephole/minimize_conditional_expression.rs | Use array literals for sequence expression construction and simplification. |
| crates/oxc_minifier/src/peephole/fold_constants.rs | Use array literals for sequence expression construction in folding paths. |
| crates/oxc_isolated_declarations/src/return_type.rs | Build union type types via array literal; remove unused ArenaVec import. |
| crates/oxc_isolated_declarations/src/function.rs | Pass union type members as an array literal to new_ts_union_type. |
| crates/oxc_ast_visit/src/utf8_to_utf16/mod.rs | Update test AST construction to pass comments/body as array literals; remove unused ArenaVec import. |
Merge activity
|
…ss array literals for `from_array_in` builder args (#24624) Pure refactor. Just shorten code. #24621 made AST builder methods take arrays as params. Replace `ArenaVec::from_array_in(...)` arguments written inline at AST builder method call sites with the array literals. ```rs let block = Statement::new_block_statement(SPAN, ArenaVec::from_array_in([x, y], ctx), ctx); ``` \-> ```rs let block = Statement::new_block_statement(SPAN, [x, y], ctx); ```
02916f6 to
b28051f
Compare
6b23ad7 to
c06982a
Compare

Pure refactor. Just shorten code.
#24621 made AST builder methods take arrays as params.
Replace
ArenaVec::from_array_in(...)arguments written inline at AST builder method call sites with the array literals.->