Skip to content

refactor(minifier): KeepVar do not create new AstBuilder#23833

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/06-25-refactor_minifier_keepvar_do_not_create_new_astbuilder_
Jun 26, 2026
Merged

refactor(minifier): KeepVar do not create new AstBuilder#23833
graphite-app[bot] merged 1 commit into
mainfrom
om/06-25-refactor_minifier_keepvar_do_not_create_new_astbuilder_

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Jun 26, 2026

Copy link
Copy Markdown
Member

Part of #23043, following on after #23832.

Avoid cloning AstBuilder in KeepVars. Instead pass &AstBuilder in to get_variable_declaration and get_variable_declaration_statement, which is the only place it's needed.

This means it will work as intended once AstBuilder becomes stateful (to generate unique NodeIds for all AST nodes). If we cloned the builder, it would lose that state.

overlookmotel commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq

codspeed-hq Bot commented Jun 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 52 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing om/06-25-refactor_minifier_keepvar_do_not_create_new_astbuilder_ (bd85673) with om/06-25-refactor_minifier_switch_to_new_astbuilder_ (b7cd88d)

Open in CodSpeed

Footnotes

  1. 19 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.

@overlookmotel overlookmotel marked this pull request as ready for review June 26, 2026 17:57
@overlookmotel overlookmotel requested a review from Dunqing as a code owner June 26, 2026 17:57
Copilot AI review requested due to automatic review settings June 26, 2026 17:57

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@graphite-app

graphite-app Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Merge activity

Part of #23043, following on after #23832.

Avoid cloning `AstBuilder` in `KeepVars`. Instead pass `&AstBuilder` in to `get_variable_declaration` and `get_variable_declaration_statement`, which is the only place it's needed.

This means it will work as intended once `AstBuilder` becomes stateful (to generate unique `NodeId`s for all AST nodes). If we cloned the builder, it would lose that state.
@graphite-app graphite-app Bot force-pushed the om/06-25-refactor_minifier_switch_to_new_astbuilder_ branch from 8b42c46 to b7cd88d Compare June 26, 2026 18:18
@graphite-app graphite-app Bot force-pushed the om/06-25-refactor_minifier_keepvar_do_not_create_new_astbuilder_ branch from f4ce0d0 to bd85673 Compare June 26, 2026 18:18
Base automatically changed from om/06-25-refactor_minifier_switch_to_new_astbuilder_ to main June 26, 2026 18:39
@graphite-app graphite-app Bot merged commit bd85673 into main Jun 26, 2026
39 checks passed
@graphite-app graphite-app Bot deleted the om/06-25-refactor_minifier_keepvar_do_not_create_new_astbuilder_ branch June 26, 2026 18:39
graphite-app Bot pushed a commit that referenced this pull request Jul 2, 2026
…uilder (#24035)

Migrates the two remaining `&AstBuilder` parameters in `KeepVar` to the new builder API convention (`&B where B: GetAstBuilder`), continuing #23832 / #23833.

This also resolves the pedantic `trivially_copy_pass_by_ref` warning that fires in default-features clippy runs (`cargo clippy -p oxc_minifier -- -D warnings`), where `AstBuilder` is `Copy`. It could not be fixed by taking `AstBuilder` by value, because under `disable_old_builder` (enabled for this crate's tests) it is not `Copy`; the generic signature is clean in both configurations.
camc314 pushed a commit that referenced this pull request Jul 3, 2026
Part of #23043, following on after #23832.

Avoid cloning `AstBuilder` in `KeepVars`. Instead pass `&AstBuilder` in to `get_variable_declaration` and `get_variable_declaration_statement`, which is the only place it's needed.

This means it will work as intended once `AstBuilder` becomes stateful (to generate unique `NodeId`s for all AST nodes). If we cloned the builder, it would lose that state.
camc314 pushed a commit that referenced this pull request Jul 3, 2026
…uilder (#24035)

Migrates the two remaining `&AstBuilder` parameters in `KeepVar` to the new builder API convention (`&B where B: GetAstBuilder`), continuing #23832 / #23833.

This also resolves the pedantic `trivially_copy_pass_by_ref` warning that fires in default-features clippy runs (`cargo clippy -p oxc_minifier -- -D warnings`), where `AstBuilder` is `Copy`. It could not be fixed by taking `AstBuilder` by value, because under `disable_old_builder` (enabled for this crate's tests) it is not `Copy`; the generic signature is clean in both configurations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants