refactor(ast_tools): generate variants by parsing repeatedly#14679
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the oxc_ast_tools code generation to produce variants by parsing the source text multiple times instead of parsing once and cloning the AST. While this is less efficient, it enables modification of source text before parsing, which supports future work in #14681.
Key Changes:
- Replace AST cloning approach with repeated parsing for each variant
- Generate flag constants with appropriate boolean values before each parse
- Simplify the variant generation flow by using an iterator-based approach
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
In `oxc_ast_tools` codegen, generated variants of code by parsing source text multiple times, instead of parsing once and then cloning AST. This is a deoptimization in itself, but allows modifying the source text prior to parsing, which is useful for #14681.
5e46661 to
6eca395
Compare

In
oxc_ast_toolscodegen, generate variants of code by parsing source text multiple times, instead of parsing once and then cloning AST. This is a deoptimization in itself, but allows modifying the source text prior to parsing, which is useful for #14681.