Skip to content

refactor(ast_visit, isolated_declarations, minifier, transformer): pass array literals for from_array_in builder args#24624

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

refactor(ast_visit, isolated_declarations, minifier, transformer): pass array literals for from_array_in builder args#24624
graphite-app[bot] merged 1 commit into
mainfrom
om/07-17-refactor_ast_visit_isolated_declarations_minifier_transformer_pass_array_literals_for_from_array_in_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_array_in(...) arguments written inline at AST builder method call sites with the array literals.

let block = Statement::new_block_statement(SPAN, ArenaVec::from_array_in([x, y], ctx), ctx);

->

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

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_ast_visit_isolated_declarations_minifier_transformer_pass_array_literals_for_from_array_in_builder_args (c06982a) 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 (c06982a) 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_ast_visit_isolated_declarations_minifier_transformer_pass_array_literals_for_from_array_in_builder_args branch from 702b234 to 6b23ad7 Compare July 17, 2026 13:08
@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 marked this pull request as ready for review July 17, 2026 13:21
@overlookmotel
overlookmotel requested a review from Dunqing as a code owner July 17, 2026 13:21
Copilot AI review requested due to automatic review settings July 17, 2026 13:21

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

@graphite-app

graphite-app Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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);
```
@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
@graphite-app
graphite-app Bot force-pushed the om/07-17-refactor_ast_visit_isolated_declarations_minifier_transformer_pass_array_literals_for_from_array_in_builder_args branch from 6b23ad7 to c06982a Compare July 17, 2026 13:52
Base automatically changed from om/07-17-refactor_all_pass_v_for_single-value_arenavec_builder_args to main July 17, 2026 13:59
@graphite-app
graphite-app Bot merged commit c06982a into main Jul 17, 2026
40 checks passed
@graphite-app
graphite-app Bot deleted the om/07-17-refactor_ast_visit_isolated_declarations_minifier_transformer_pass_array_literals_for_from_array_in_builder_args branch July 17, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-isolated-declarations Isolated Declarations A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants