Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Oct 16, 2025

In oxc_ast_tools codegen, 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.

@github-actions github-actions bot added A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 16, 2025
Copy link
Member Author

overlookmotel commented Oct 16, 2025


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 hot fixes, skip the queue and merge this PR next

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@overlookmotel overlookmotel self-assigned this Oct 16, 2025
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 16, 2025

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.
@graphite-app graphite-app bot force-pushed the 10-16-refactor_ast_tools_generate_variants_by_parsing_repeatedly branch from 5e46661 to 6eca395 Compare October 16, 2025 20:51
@graphite-app graphite-app bot merged commit 6eca395 into main Oct 16, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 10-16-refactor_ast_tools_generate_variants_by_parsing_repeatedly branch October 16, 2025 20:56
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants