refactor(minifier): KeepVar do not create new AstBuilder#23833
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
Merging this PR will not alter performance
Comparing Footnotes
|
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.
8b42c46 to
b7cd88d
Compare
f4ce0d0 to
bd85673
Compare
…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.
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.
…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.

Part of #23043, following on after #23832.
Avoid cloning
AstBuilderinKeepVars. Instead pass&AstBuilderin toget_variable_declarationandget_variable_declaration_statement, which is the only place it's needed.This means it will work as intended once
AstBuilderbecomes stateful (to generate uniqueNodeIds for all AST nodes). If we cloned the builder, it would lose that state.