feat(oxc_allocator): Add new method clone_in_with_semantic_ids for CloneIn trait#8608
feat(oxc_allocator): Add new method clone_in_with_semantic_ids for CloneIn trait#8608IWANABETHATGUY wants to merge 1 commit intomainfrom
clone_in_with_semantic_ids for CloneIn trait#8608Conversation
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. |
| pub directives: Vec<'a, Directive<'a>>, | ||
| pub body: Vec<'a, Statement<'a>>, | ||
| #[estree(skip)] | ||
| #[clone_in(default)] |
There was a problem hiding this comment.
This is not right, should use cfg(attribete)
|
Can you provide some context and link your Rolldown prototype for other reviewers? |
OK, I will link it once the new poc is finished. |
|
I'm not quite sure what you're trying to achieve here, but this may be relevant: oxc-project/backlog#127
At present, it unsets all But if we go the other way (as in your PR), then it will have ID fields set, but they're likely to be the wrong IDs. So either way is wrong! See also: oxc-project/backlog#96 |
incremental build scenario, since we need to modify the ast after parsing, we clone |
|
Ah I see. If you clone both the AST and also the matching But I suggest we introduce a new trait for this use case
Note on naming: I suggest We need I assume you'll also need a way to get the capacity required for the allocator you're cloning into, so I've also added that in #8621. Please take a look and confirm that covers what you need. |
|
Actually maybe we don't need a new trait. We could just add a 2nd method to ...and document the pitfalls of using this method! @IWANABETHATGUY Are you comfortable enough with |
Thanks for your guiding, I will try it tomorrow. I am working on other thing today. |
091b93a to
e5c451e
Compare
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. |
73768c1 to
a519e6e
Compare
clone_in_with_semantic_ids for CloneIn trait
CodSpeed Performance ReportMerging #8608 will not alter performanceComparing Summary
|
| /// Almost same as `clone_in`, but for some special type, it will also clone the semantic ids. | ||
| #[inline] | ||
| fn clone_in_with_semantic_ids(&self, allocator: &'new_alloc Allocator) -> Self::Cloned { | ||
| self.clone_in(allocator) | ||
| } |
There was a problem hiding this comment.
Please expand this comment to explain why it's generally a bad idea to use this method.
1dd4c8e to
c479a19
Compare
ad3ef33 to
6c5e36c
Compare
6c5e36c to
8cc9f24
Compare
|
To make sure this PR work as intended, let's review and merge once there's a corresponding working PR in Rolldown. |
that make sense |

clone_inthe new method also clonesemanticfields, this is used for scenario like caching ast and semantic data at the same time.