Skip to content

refactor(all): pass [v] for single-value ArenaVec builder args#24623

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args
Jul 17, 2026
Merged

refactor(all): pass [v] for single-value ArenaVec builder args#24623
graphite-app[bot] merged 1 commit into
mainfrom
om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Jul 17, 2026

Copy link
Copy Markdown
Member

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.

let block = Statement::new_block_statement(
    SPAN,
    ArenaVec::from_value_in(return_stmt, ctx),
    ctx,
);

->

let block = Statement::new_block_statement(SPAN, [return_stmt], ctx);

@github-actions github-actions Bot added A-parser Area - Parser A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations labels Jul 17, 2026

overlookmotel commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 67 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args (b28051f) with main (2338c13)2

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (b28051f) during the generation of this report, so 2338c13 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel
overlookmotel force-pushed the om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args branch from 6644623 to 02916f6 Compare July 17, 2026 13:08
@overlookmotel
overlookmotel force-pushed the om/07-17-refactor_all_pass_for_empty_arenavec_args_to_ast_builder_methods branch from 60d1e75 to 25e0cac Compare July 17, 2026 13:08
@overlookmotel
overlookmotel marked this pull request as ready for review July 17, 2026 13:18
@overlookmotel
overlookmotel requested a review from Dunqing as a code owner July 17, 2026 13:18
Copilot AI review requested due to automatic review settings July 17, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ArenaVec imports 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.

@graphite-app

graphite-app Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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);
```
@graphite-app
graphite-app Bot force-pushed the om/07-17-refactor_all_pass_for_empty_arenavec_args_to_ast_builder_methods branch from 25e0cac to c1a074c Compare July 17, 2026 13:51
@graphite-app
graphite-app Bot force-pushed the om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args branch from 02916f6 to b28051f Compare July 17, 2026 13:52
Base automatically changed from om/07-17-refactor_all_pass_for_empty_arenavec_args_to_ast_builder_methods to main July 17, 2026 13:58
@graphite-app
graphite-app Bot merged commit b28051f into main Jul 17, 2026
41 checks passed
@graphite-app
graphite-app Bot deleted the om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args branch July 17, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations A-minifier Area - Minifier A-parser Area - Parser A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants