refactor(ast_tools): remove special-case logic for NodeId from ESTree generator#21678
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR simplifies the ESTree generator logic in tasks/ast_tools by removing a hard-coded “skip node_id by name” special case and instead relying on schema-driven #[estree(skip)] metadata attached to the NodeId type.
Changes:
- Removed the
field.name() == "node_id"special-case fromshould_skip_field. - Marked
oxc_syntax::node::NodeIdwith#[estree(skip)]so any fields containingNodeIdare skipped via the existing type-based skip path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/ast_tools/src/derives/estree.rs | Removes the node_id name-based skip and relies on existing “innermost type has #[estree(skip)]” logic. |
| crates/oxc_syntax/src/node.rs | Adds #[estree(skip)] to NodeId so Cell<NodeId> (and other wrappers) are skipped consistently by generators using should_skip_field. |
a30b94f to
786fcd5
Compare
89eeb44 to
6c09f85
Compare
Merge activity
|
786fcd5 to
ed660cf
Compare
…ree` generator (#21678) Simplify `ESTree` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, add a `#[estree(skip)]` attr to `NodeId` type, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field. Does not alter generated code, only the means by which it's generated.
6c09f85 to
459e860
Compare
ed660cf to
f30e3c2
Compare
…ree` generator (#21678) Simplify `ESTree` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, add a `#[estree(skip)]` attr to `NodeId` type, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field. Does not alter generated code, only the means by which it's generated.
459e860 to
545209c
Compare
f30e3c2 to
ea3bfd8
Compare
…ree` generator (#21678) Simplify `ESTree` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, add a `#[estree(skip)]` attr to `NodeId` type, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field. Does not alter generated code, only the means by which it's generated.
545209c to
6adf026
Compare
…ree` generator (#21678) Simplify `ESTree` generator in `ast_tools`. Previously it had "special case" code for `NodeId`. Instead, add a `#[estree(skip)]` attr to `NodeId` type, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field. Does not alter generated code, only the means by which it's generated.
ea3bfd8 to
aad7d98
Compare
6adf026 to
1a9e967
Compare

Simplify
ESTreegenerator inast_tools.Previously it had "special case" code for
NodeId. Instead, add a#[estree(skip)]attr toNodeIdtype, and thennode_id: Cell<NodeId>fields can be treated the same as any other field.Does not alter generated code, only the means by which it's generated.