Skip to content

refactor(ast_tools): simplify AstKind generator#20942

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-01-refactor_ast_tools_simplify_astkind_generator
Apr 1, 2026
Merged

refactor(ast_tools): simplify AstKind generator#20942
graphite-app[bot] merged 1 commit intomainfrom
om/04-01-refactor_ast_tools_simplify_astkind_generator

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 1, 2026

AstKind generator had code paths to handle enums which have an AstKind. We made AstKinds only apply to structs a few months back, so this is now dead code. Remove it.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 1, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions Bot added A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Apr 1, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 1, 2026 18:01
Copilot AI review requested due to automatic review settings April 1, 2026 18:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes dead code from the AstKind code generator by eliminating enum-handling paths, reflecting the current rule that AstKind variants are generated only for structs.

Changes:

  • Simplified the generation loop by early-skipping non-struct TypeDefs via as_struct().
  • Simplified node_id setter generation by removing TypeDef pattern matching in favor of direct struct inspection.
  • Updated as_* method name generation to use the struct definition directly.

@overlookmotel overlookmotel self-assigned this Apr 1, 2026
@graphite-app graphite-app Bot added the 0-merge Merge with Graphite Merge Queue label Apr 1, 2026
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 1, 2026

Merge activity

`AstKind` generator had code paths to handle enums which have an `AstKind`. We made `AstKind`s only apply to structs a few months back, so this is now dead code. Remove it.
@graphite-app graphite-app Bot force-pushed the om/04-01-refactor_ast_tools_simplify_structsandenums_iterator branch from 4f23c14 to b782a4b Compare April 1, 2026 18:13
@graphite-app graphite-app Bot force-pushed the om/04-01-refactor_ast_tools_simplify_astkind_generator branch from 7463340 to da91ccc Compare April 1, 2026 18:14
Base automatically changed from om/04-01-refactor_ast_tools_simplify_structsandenums_iterator to main April 1, 2026 18:17
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Apr 1, 2026
@graphite-app graphite-app Bot merged commit da91ccc into main Apr 1, 2026
25 checks passed
@graphite-app graphite-app Bot deleted the om/04-01-refactor_ast_tools_simplify_astkind_generator branch April 1, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants