feat(syntax)!: remove CommentNodeId#21679
Merged
graphite-app[bot] merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
This was referenced Apr 23, 2026
Member
Author
This was referenced Apr 23, 2026
Merging this PR will not alter performance
Comparing Footnotes
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the unused CommentNodeId type from oxc_syntax and cleans up all remaining references, aligning the codebase with the existing NodeId fields on AST nodes and simplifying generated code.
Changes:
- Delete the
CommentNodeIddefinition/module and remove its exports fromoxc_syntax. - Remove
CommentNodeIdfrom generated layout/assertion andCloneIncode inoxc_syntax. - Update
ast_toolsandoxc_astbuilder codegen/imports to stop referencingCommentNodeId.
Reviewed changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tasks/ast_tools/src/generators/ast_builder.rs | Updates builder codegen inputs/imports to avoid CommentNodeId and lean on NodeId. |
| tasks/ast_tools/src/generators/assert_layouts.rs | Removes comment_node module imports from generated layout assertion template. |
| crates/oxc_syntax/src/lib.rs | Stops exporting the removed comment_node module. |
| crates/oxc_syntax/src/generated/derive_clone_in.rs | Removes generated CloneIn impl/import for CommentNodeId. |
| crates/oxc_syntax/src/generated/assert_layouts.rs | Removes generated layout assertions/imports for CommentNodeId. |
| crates/oxc_syntax/src/comment_node.rs | Deletes the CommentNodeId type implementation. |
| crates/oxc_ast_macros/src/generated/structs.rs | Regenerates struct metadata to drop CommentNodeId. |
| crates/oxc_ast/src/generated/ast_builder.rs | Removes CommentNodeId import from generated AST builder. |
| crates/oxc_ast/src/ast_builder_impl.rs | Removes unused get_comment_node_id helper and related imports. |
c37f302 to
9636056
Compare
89eeb44 to
6c09f85
Compare
This was referenced Apr 23, 2026
Contributor
Merge activity
|
6c09f85 to
459e860
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
`CommentNodeId` is a type we added some time ago, but never used. We now have `NodeId`s stored in all AST structs, so we can use that for comment attachment if we choose. Remove `CommentNodeId` type, and all code referencing it. Only code remaining that references it is in `ast_tools` codegen. I've left that code so that it can be repurposed for `NodeId` in next PR (#21680).
9636056 to
fe2844f
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
… for `NodeId` (#21680) #21679 remove `CommentNodeId`. Repurpose code in `ast_tools` codegen which was designed for `CommentNodeId`, using it for `NodeId` instead. Notably: 1. Check if fields are `Cell<NodeId>` with a quick `TypeId` comparison, instead of string comparison on field name (more reliable, and faster). 2. Simplify generator for `AstBuilder` by utilizing existing logic for default fields for `NodeId` fields.
459e860 to
545209c
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
`CommentNodeId` is a type we added some time ago, but never used. We now have `NodeId`s stored in all AST structs, so we can use that for comment attachment if we choose. Remove `CommentNodeId` type, and all code referencing it. Only code remaining that references it is in `ast_tools` codegen. I've left that code so that it can be repurposed for `NodeId` in next PR (#21680).
fe2844f to
bd8bd58
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
… for `NodeId` (#21680) #21679 remove `CommentNodeId`. Repurpose code in `ast_tools` codegen which was designed for `CommentNodeId`, using it for `NodeId` instead. Notably: 1. Check if fields are `Cell<NodeId>` with a quick `TypeId` comparison, instead of string comparison on field name (more reliable, and faster). 2. Simplify generator for `AstBuilder` by utilizing existing logic for default fields for `NodeId` fields.
545209c to
6adf026
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
`CommentNodeId` is a type we added some time ago, but never used. We now have `NodeId`s stored in all AST structs, so we can use that for comment attachment if we choose. Remove `CommentNodeId` type, and all code referencing it. Only code remaining that references it is in `ast_tools` codegen. I've left that code so that it can be repurposed for `NodeId` in next PR (#21680).
bd8bd58 to
ff5c7f9
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
… for `NodeId` (#21680) #21679 remove `CommentNodeId`. Repurpose code in `ast_tools` codegen which was designed for `CommentNodeId`, using it for `NodeId` instead. Notably: 1. Check if fields are `Cell<NodeId>` with a quick `TypeId` comparison, instead of string comparison on field name (more reliable, and faster). 2. Simplify generator for `AstBuilder` by utilizing existing logic for default fields for `NodeId` fields.
`CommentNodeId` is a type we added some time ago, but never used. We now have `NodeId`s stored in all AST structs, so we can use that for comment attachment if we choose. Remove `CommentNodeId` type, and all code referencing it. Only code remaining that references it is in `ast_tools` codegen. I've left that code so that it can be repurposed for `NodeId` in next PR (#21680).
6adf026 to
1a9e967
Compare
ff5c7f9 to
c5b3deb
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
… for `NodeId` (#21680) #21679 remove `CommentNodeId`. Repurpose code in `ast_tools` codegen which was designed for `CommentNodeId`, using it for `NodeId` instead. Notably: 1. Check if fields are `Cell<NodeId>` with a quick `TypeId` comparison, instead of string comparison on field name (more reliable, and faster). 2. Simplify generator for `AstBuilder` by utilizing existing logic for default fields for `NodeId` fields.
Base automatically changed from
om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_estree_generator
to
main
April 23, 2026 18:44
camc314
pushed a commit
that referenced
this pull request
Apr 27, 2026
### 💥 BREAKING CHANGES - 502e804 ast: [**BREAKING**] Reduce size of `TSTypePredicateName` (#21711) (overlookmotel) - 5651539 ast: [**BREAKING**] Reduce size of `JSXExpression` (#21710) (overlookmotel) - c44e280 ast: [**BREAKING**] Reduce size of `ArrayExpressionElement` (#21709) (overlookmotel) - c5b3deb syntax: [**BREAKING**] Remove `CommentNodeId` (#21679) (overlookmotel) ### 🚀 Features - b738a39 allocator: Add `Allocator::cursor_ptr` method (#21773) (overlookmotel) - 678767e ast: Generate node_id accessors for AST enum wrappers (#21653) (camc314) - f091d77 minifier: Inline constant spread elements into arrays (#21095) (Armano) ### 🐛 Bug Fixes - 0d608c2 minifier: Preserve raw CR in template literals (#21645) (Dunqing) - a889ea9 minifier: Track pure functions in DCE mode (#21722) (Dunqing) - 674dfac allocator: `Arena` retry allocation when chunk size approaches maximum (#21777) (overlookmotel) - f130cc0 allocator: Fix arithmetic overflow in `Arena::new_chunk_memory_details` (#21745) (overlookmotel) - b9bf239 allocator: Fix UB in `Arena::grow_zeroed` (#21739) (overlookmotel) - d2b9389 allocator: Clippy warning when building without `testing` feature (#21681) (camc314) - 503dc86 codegen: Map sourcemaps from visible output starts (#21662) (Dunqing) - c92bd3b transformer: Use SPAN for synthesized helper calls to prevent comment misattribution (#21578) (Dunqing) - 0d80441 codegen: Add mapping before printing `#` for private ident (#21619) (camc314) ### ⚡ Performance - 9fa362e napi/parser: Do not generate tokens except in tests (#21811) (overlookmotel) - 0044392 allocator: Reduce branches when allocating new chunk (#21776) (overlookmotel) - 7896bd0 allocator: `Allocator::used_bytes` do not use chunk iterator (#21771) (overlookmotel) - a5c562f allocator: Remove check in `Arena::new_chunk_memory_details` (#21750) (overlookmotel) - 35bbe1f allocator: `Arena` use unchecked size round up where guaranteed no overflow (#21743) (overlookmotel) - ffe229b allocator: Remove unnecessary check from `Arena::try_alloc_layout_slow_impl` (#21732) (overlookmotel) - 72fece5 allocator: Use `NonNull::offset_from_unsigned` in `Arena::chunk_capacity` (#21731) (overlookmotel) - cab32ae ast: Add `#[inline(always)]` to `node_id` methods on enums with all variants unboxed (#21707) (overlookmotel) - b179688 parser: Allocate `TriviaBuilder` comments in the arena (#21512) (Boshen) - 2290f31 lexer: Fix perf of `Token::set_*` methods on Rust 1.95.0 (#21659) (overlookmotel) - 1b58029 allocator: Move code into cold path in `Arena::alloc_layout` (#21622) (overlookmotel) - 3cf7cef allocator: Reduce instructions on allocation hot path (#21510) (overlookmotel) ### 📚 Documentation - ce65070 data_structures: Document why `as_ref` and `as_mut` on `NonNullConst` and `NonNullMut` take `self` (#21800) (overlookmotel) - 93b7dbd allocator: Improve doc comments for `ChunkFooter` (#21733) (overlookmotel) - 295db8d transformer: Fix comment (#21717) (overlookmotel) - 5c93af8 ast: Add comments explaining `#[inline(always)]` to `node_id` methods on enums (#21706) (overlookmotel) - e4cea25 transform: Use the `node:` namespace in the example (#19998) (루밀LuMir) ### 🛡️ Security - d8076c9 deps: Update rolldown (#21639) (renovate) Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
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
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.

CommentNodeIdis a type we added some time ago, but never used. We now haveNodeIds stored in all AST structs, so we can use that for comment attachment if we choose.Remove
CommentNodeIdtype, and all code referencing it.Only code remaining that references it is in
ast_toolscodegen. I've left that code so that it can be repurposed forNodeIdin next PR (#21680).