refactor(all): pass [v] for single-value ArenaVec builder args#24623
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
6644623 to
02916f6
Compare
60d1e75 to
25e0cac
Compare
There was a problem hiding this comment.
Pull request overview
Refactors call sites across the Rust workspace to take advantage of the newer AST builder APIs that accept arrays for ArenaVec-typed parameters, reducing boilerplate and improving readability.
Changes:
- Replaces many
ArenaVec::from_value_in(v, alloc)single-element constructions with array literals like[v]when passing into AST builder/constructor methods. - Cleans up related temporary variables and removes now-unused
ArenaVecimports in multiple modules. - Updates a handful of tests and codegen paths to use the same shorter array-literal style.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_transformer/src/utils/ast_builder.rs | Uses [arg] for single call arguments in helper builders. |
| crates/oxc_transformer/src/typescript/namespace.rs | Simplifies variable-decl and IIFE-call argument construction with [item]. |
| crates/oxc_transformer/src/typescript/module.rs | Replaces single-argument require(...) vec builder with [argument] and removes ArenaVec import. |
| crates/oxc_transformer/src/typescript/enum.rs | Uses array literals for params/arguments and single declarator lists. |
| crates/oxc_transformer/src/typescript/annotations.rs | Uses [stmt] when building a single-statement scoped block. |
| crates/oxc_transformer/src/plugins/tagged_template_transform.rs | Uses [variable] for single declarator list. |
| crates/oxc_transformer/src/plugins/styled_components.rs | Replaces single-element vec builders with [ ... ] in runtime code and tests. |
| crates/oxc_transformer/src/jsx/refresh.rs | Uses [return_stmt] for single-statement function bodies. |
| crates/oxc_transformer/src/jsx/jsx_source.rs | Uses [decl] for a single variable declarator. |
| crates/oxc_transformer/src/jsx/jsx_impl.rs | Uses [declarator] for a single variable declarator. |
| crates/oxc_transformer/src/es2026/explicit_resource_management.rs | Replaces multiple single-element vec constructions with array literals throughout transforms. |
| crates/oxc_transformer/src/es2022/class_properties/utils.rs | Uses [declarator] and removes now-unused ArenaVec import. |
| crates/oxc_transformer/src/es2022/class_properties/prop_decl.rs | Uses [property] for single-property object expression creation. |
| crates/oxc_transformer/src/es2022/class_properties/private_field.rs | Uses [argument] for single call argument construction. |
| crates/oxc_transformer/src/es2022/class_properties/constructor.rs | Uses [declarator] / [Argument::from(...)] for single-element vec params. |
| crates/oxc_transformer/src/es2020/optional_chaining.rs | Uses [context] for .bind(...) call argument list. |
| crates/oxc_transformer/src/es2020/nullish_coalescing_operator.rs | Uses [param] and [stmt] for single-parameter and single-statement bodies; removes ArenaVec import. |
| crates/oxc_transformer/src/es2020/export_namespace_from.rs | Uses [export_specifier] for single export specifier list. |
| crates/oxc_transformer/src/es2018/async_generator_functions/for_await.rs | Replaces many single-statement blocks/declarations with [stmt] array literals. |
| crates/oxc_transformer/src/es2017/async_to_generator.rs | Uses [statement] for wrapper function body. |
| crates/oxc_transformer/src/decorator/legacy/mod.rs | Uses [param], [stmt], [specifier] etc. for single-element builder params. |
| crates/oxc_transformer/src/common/module_imports.rs | Uses [arg] / [decl] for single-element builder params. |
| crates/oxc_transformer/src/common/arrow_function_converter.rs | Uses [statement] for single-statement arrow function bodies. |
| crates/oxc_transformer_plugins/src/module_runner_transform.rs | Uses array literals for single call args / object props / decl lists / function bodies. |
| crates/oxc_react_compiler/src/react_compiler/entrypoint/program.rs | Uses [declarator] / [Argument::from(...)] for single-element vec params. |
| crates/oxc_react_compiler/src/react_compiler_reactive_scopes/codegen_reactive_function.rs | Uses [arg], [stmt], [declarator], and inline single-property object arrays. |
| crates/oxc_parser/src/ts/types.rs | Uses [outer_property] for a single-property object expression. |
| crates/oxc_parser/src/js/arrow.rs | Uses [formal_parameter] and [expr_stmt]; removes ArenaVec import. |
| crates/oxc_minifier/tests/ecmascript/to_string.rs | Uses [ObjectPropertyKind::...] and removes ArenaVec import in tests. |
| crates/oxc_minifier/tests/ecmascript/to_number.rs | Uses [ObjectPropertyKind::...] and [element] arrays; removes ArenaVec import in tests. |
| crates/oxc_minifier/src/peephole/substitute_alternate_syntax.rs | Uses array literals for single array elements / call args / string literal args. |
| crates/oxc_minifier/src/peephole/remove_unused_expression.rs | Uses [ArrayExpressionElement::...] for single-element array expressions. |
| crates/oxc_minifier/src/peephole/minimize_statements.rs | Uses [decl] for a single declarator in a boxed variable declaration. |
| crates/oxc_minifier/src/peephole/minimize_if_statement.rs | Uses [stmt] for single-statement block creation; removes ArenaVec import. |
| crates/oxc_isolated_declarations/src/module.rs | Uses [declaration] for a single declarator list. |
| crates/oxc_isolated_declarations/src/class.rs | Uses [parameter] for signature formal parameters. |
| crates/oxc_codegen/tests/integration/js.rs | Uses [element] / [stmt] in AST-building tests; removes ArenaVec import. |
Merge activity
|
…24623) Pure refactor. Just shorten code. #24621 made AST builder methods take arrays as params. Replace `ArenaVec::from_value_in(v, alloc)` with `[v]` where the `ArenaVec` is passed to an AST builder method. ```rs let block = Statement::new_block_statement( SPAN, ArenaVec::from_value_in(return_stmt, ctx), ctx, ); ``` \-> ```rs let block = Statement::new_block_statement(SPAN, [return_stmt], ctx); ```
25e0cac to
c1a074c
Compare
02916f6 to
b28051f
Compare

Pure refactor. Just shorten code.
#24621 made AST builder methods take arrays as params.
Replace
ArenaVec::from_value_in(v, alloc)with[v]where theArenaVecis passed to an AST builder method.->