refactor(ast_tools): remove kind from EnumDef#21684
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
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the unused kind extension from EnumDef (enums never have AstKind) and simplifies generators by deleting now-dead enum-kind branches, without changing generated output.
Changes:
- Remove
kind: KindfromEnumDefand its initialization/imports. - Simplify visitor and formatter generators by hardcoding “no kind” behavior for enums.
- Simplify formatter
AstNodesgeneration to consider only structs forAstKind-backed node variants.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tasks/ast_tools/src/schema/extensions/kind.rs | Update Kind docs to reflect struct-only usage. |
| tasks/ast_tools/src/schema/defs/enum.rs | Remove kind field from EnumDef and constructor init. |
| tasks/ast_tools/src/generators/visit.rs | Drop enum has_kind handling; always generate enter/leave-node hooks as “no kind” for enums. |
| tasks/ast_tools/src/generators/formatter/format.rs | Remove dead enum-kind parent allocation path; always use self.parent for enums. |
| tasks/ast_tools/src/generators/formatter/ast_nodes.rs | Remove enum-kind paths from AstNodes name collection, span handling, and enum impl generation helpers. |
Member
Author
|
@Dunqing I'm planning to merge this without waiting for your review, as it doesn't alter any generated code. But just pinging you since it makes changes in your area (formatter). |
Contributor
Merge activity
|
977d89e to
2fba253
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
It's been the case for a while that only structs have `AstKind`s, never enums. So:
1. Remove `kind` field from `EnumDef` - it's always `Kind { has_kind: false }`.
2. Simplify generators which had code to handle enums which have an `AstKind`. It's dead code, as none do.
Does not alter generated code, only simplifies the means by which it's produced.
cf1e835 to
4bfbe8f
Compare
2fba253 to
8937d6b
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
It's been the case for a while that only structs have `AstKind`s, never enums. So:
1. Remove `kind` field from `EnumDef` - it's always `Kind { has_kind: false }`.
2. Simplify generators which had code to handle enums which have an `AstKind`. It's dead code, as none do.
Does not alter generated code, only simplifies the means by which it's produced.
4bfbe8f to
7dfdfdb
Compare
8937d6b to
c5d23e4
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Apr 23, 2026
It's been the case for a while that only structs have `AstKind`s, never enums. So:
1. Remove `kind` field from `EnumDef` - it's always `Kind { has_kind: false }`.
2. Simplify generators which had code to handle enums which have an `AstKind`. It's dead code, as none do.
Does not alter generated code, only simplifies the means by which it's produced.
7dfdfdb to
3ca13a1
Compare
It's been the case for a while that only structs have `AstKind`s, never enums. So:
1. Remove `kind` field from `EnumDef` - it's always `Kind { has_kind: false }`.
2. Simplify generators which had code to handle enums which have an `AstKind`. It's dead code, as none do.
Does not alter generated code, only simplifies the means by which it's produced.
c5d23e4 to
7c960d9
Compare
3ca13a1 to
1c50067
Compare
Base automatically changed from
om/02-14-docs_ast_tools_correct_doc_comment_for_astkind_codegen
to
main
April 23, 2026 18:47
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.

It's been the case for a while that only structs have
AstKinds, never enums. So:kindfield fromEnumDef- it's alwaysKind { has_kind: false }.AstKind. It's dead code, as none do.Does not alter generated code, only simplifies the means by which it's produced.