refactor(ast_tools): remove special-case logic for NodeId from Dummy generator#21676
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR simplifies the Dummy derive generator by removing a hardcoded special case for node_id fields, and instead makes NodeId participate in the normal Dummy trait flow. This aligns NodeId with other AST helper ID types and keeps the generator logic uniform.
Changes:
- Remove the
node_idfield-name special case from theDummyimpl generator for structs. - Implement
Dummyforoxc_syntax::node::NodeId(returningNodeId::DUMMY). - Regenerate
crates/oxc_ast’sderive_dummy.rssonode_idfields useDummy::dummy(allocator)like other fields.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/ast_tools/src/derives/dummy.rs | Removes node_id-specific codegen path so struct fields are generated uniformly. |
| crates/oxc_syntax/src/node.rs | Adds Dummy impl for NodeId to support uniform dummy construction. |
| crates/oxc_ast/src/generated/derive_dummy.rs | Regenerated output: node_id initialization now goes through Dummy::dummy. |
cabcc3c to
f368805
Compare
fe4ed7c to
00d9078
Compare
Merge activity
|
f368805 to
d8fc207
Compare
…my` generator (#21676) Simplify `Dummy` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, implement `Dummy` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
00d9078 to
150d25b
Compare
d8fc207 to
773bd50
Compare
…my` generator (#21676) Simplify `Dummy` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, implement `Dummy` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
150d25b to
28e97e7
Compare
773bd50 to
4ab852a
Compare
…my` generator (#21676) Simplify `Dummy` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, implement `Dummy` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
28e97e7 to
30d2660
Compare
…my` generator (#21676) Simplify `Dummy` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, implement `Dummy` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
4ab852a to
94772d0
Compare
30d2660 to
06fa11e
Compare

Simplify
Dummygenerator inast_tools.Previously it had "special case" code for
NodeId. Instead, implementDummyonNodeId, and thennode_id: Cell<NodeId>fields can be treated the same as any other field.