refactor(ast): move AstKind::ty out of generated code#24390
Conversation
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. |
There was a problem hiding this comment.
Pull request overview
Refactors oxc_ast so AstKind::ty() lives in handwritten code (ast_kind_impl.rs) rather than in the generated generated/ast_kind.rs, aligning with the intent that ty() is pure static logic and doesn’t need codegen.
Changes:
- Removed
AstKind::ty()(and itsNonNullimport) from the AST kind generator output. - Removed the generated
AstKind::ty()implementation fromcrates/oxc_ast/src/generated/ast_kind.rs. - Added the
AstKind::ty()implementation tocrates/oxc_ast/src/ast_kind_impl.rs.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/ast_tools/src/generators/ast_kind.rs | Stops generating AstKind::ty() and the NonNull import. |
| crates/oxc_ast/src/generated/ast_kind.rs | Removes the generated ty() method and now only contains the remaining generated impls (e.g., node_id). |
| crates/oxc_ast/src/ast_kind_impl.rs | Adds AstKind::ty() as a non-generated inherent method (including required imports). |
Merge activity
|
Follow-on after #24381. `AstKind::ty` is pure static code. It doesn't need to be generated. Move it out of the generated code.
4aaaccc to
347c61b
Compare
bdd8770 to
19ad4a8
Compare
Merging this PR will not alter performance
Comparing Footnotes
|

Follow-on after #24381.
AstKind::tyis pure static code. It doesn't need to be generated. Move it out of the generated code.