perf(scope_hoisting): remove alloc field from ScopeHoistingFinalizer#10425
Conversation
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to 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. |
There was a problem hiding this comment.
Pull request overview
This PR continues the ScopeHoistingFinalizer cleanup from #10424 by removing the redundant alloc: &Allocator field and routing all remaining allocations through the existing AstBuilder<'ast> (and the GetAllocator trait), avoiding duplicated allocator references in the finalizer state.
Changes:
- Removed the
allocfield fromScopeHoistingFinalizerand its construction site. - Replaced remaining
self.allocuses withself.allocator()/self.ast_builder.allocator()-backed calls. - Updated visitor code to use
GetAllocatorfor allocator access where needed.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/rolldown/src/module_finalizers/mod.rs | Drops the alloc field and migrates allocations/clones/into_in calls to self.allocator() (backed by ast_builder). |
| crates/rolldown/src/module_finalizers/impl_visit_mut.rs | Imports GetAllocator and switches JSX member expression conversions to use self.allocator(). |
| crates/rolldown/src/module_finalizers/finalizer_context.rs | Updates ScopeHoistingFinalizer initialization to no longer set alloc, relying on AstBuilder::new(alloc) only. |
Merging this PR will not alter performance
Comparing Footnotes
|
0b48133 to
6802e7c
Compare
82ebb1d to
75a6bb4
Compare
Merge activity
|
…er` (#10425) Continuation of #10424. `ScopeHoistingFinalizer` has these fields: ```rust pub struct ScopeHoistingFinalizer<'me, 'ast: 'me> { pub alloc: &'ast Allocator, pub ast_builder: AstBuilder<'ast>, // ... other fields ... } ``` `AstBuilder<'ast>` already contains an `&'ast Allocator`, so this was duplicating the same reference twice. #10424 removed most usages of `alloc` field as a by-product of shortening code. This PR removes the remaining usage, and removes the `alloc` field itself.
6802e7c to
8d87835
Compare
75a6bb4 to
df12b36
Compare

Continuation of #10424.
ScopeHoistingFinalizerhas these fields:AstBuilder<'ast>already contains an&'ast Allocator, so this was duplicating the same reference twice.#10424 removed most usages of
allocfield as a by-product of shortening code. This PR removes the remaining usage, and removes theallocfield itself.