-
-
Notifications
You must be signed in to change notification settings - Fork 707
feat(ast_tools): support comment blocks in variants #14681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
graphite-app
merged 1 commit into
main
from
10-16-feat_ast_tools_support_comment_blocks_in_variants
Oct 16, 2025
Merged
feat(ast_tools): support comment blocks in variants #14681
graphite-app
merged 1 commit into
main
from
10-16-feat_ast_tools_support_comment_blocks_in_variants
Oct 16, 2025
+43
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This was referenced Oct 16, 2025
Merge activity
|
Add the ability to feature-gate code with comments as well as constants.
Before:
```js
if (THING) doStuff();
if (!THING) doOtherStuff();
```
After:
```js
/* IF THING */
doStuff();
/* END_IF */
/* IF !THING */
doOtherStuff();
/* END_IF */
```
The first form is still supported, but the latter is useful in places where the former doesn't work e.g.:
```js
/* IF THING */
export function doStuff() { /* ... */ }
/* END_IF */
```
If `THING` flag is not set for a variant, the code between the comments will be stripped out.
graphite-app bot
pushed a commit
that referenced
this pull request
Oct 16, 2025
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.
48387a6 to
b0dade2
Compare
54e9ef6 to
eaf1ab1
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Oct 16, 2025
Pure refactor. Simplify the codegen for ESTree walker, using the feature flag comments introduced in #14681. Does not alter the generated code, only the codegen.
Base automatically changed from
10-16-perf_ast_tools_parallelize_minifying_code
to
main
October 16, 2025 20:56
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Add the ability to feature-gate code with comments as well as constants.
Before:
After:
The first form is still supported, but the latter is useful in places where the former doesn't work e.g.:
If
THINGflag is not set for a variant, the code between the comments will be stripped out.