Skip to content

refactor(ast_tools): include NodeId in AST schema#21673

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/02-14-refactor_ast_tools_include_nodeid_in_ast_schema
Apr 23, 2026
Merged

refactor(ast_tools): include NodeId in AST schema#21673
graphite-app[bot] merged 1 commit into
mainfrom
om/02-14-refactor_ast_tools_include_nodeid_in_ast_schema

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Apr 23, 2026

Copy link
Copy Markdown
Member

Simplify treatment of NodeId in ast_tools codegen.

Add #[ast] attr to the type, and allow codegen to discover it, rather than hard-coding it into codegen as a "primitive" type.

This matches how SymbolId, ScopeId and ReferenceId are treated.

Does not alter generated code, only the means by which it's generated.

overlookmotel commented Apr 23, 2026

Copy link
Copy Markdown
Member Author

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.

@codspeed-hq

codspeed-hq Bot commented Apr 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/02-14-refactor_ast_tools_include_nodeid_in_ast_schema (58b3e46) with main (b179688)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@overlookmotel overlookmotel self-assigned this Apr 23, 2026
@overlookmotel
overlookmotel marked this pull request as ready for review April 23, 2026 12:41
Copilot AI review requested due to automatic review settings April 23, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors ast_tools schema/codegen to treat NodeId like other AST-discoverable ID types by marking it with #[ast] and removing hard-coded “primitive” handling.

Changes:

  • Annotate NodeId with #[ast] so it can be discovered via AST schema parsing.
  • Remove NodeId special-casing from primitive handling in parsing and raw-transfer generators.
  • Update layout assertion generation to treat NodeId as a struct and regenerate related checked-in generated artifacts.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/ast_tools/src/parse/parse.rs Removes NodeId from the hard-coded primitive type list.
tasks/ast_tools/src/generators/raw_transfer_lazy.rs Drops the primitive-specific skip for NodeId (no longer a primitive).
tasks/ast_tools/src/generators/raw_transfer.rs Drops the primitive-specific skip for NodeId (no longer a primitive).
tasks/ast_tools/src/generators/assert_layouts.rs Treats NodeId as a struct for layout calculation and updates imports accordingly.
crates/oxc_syntax/src/node.rs Adds #[ast] to NodeId and imports the ast attribute.
crates/oxc_syntax/src/generated/assert_layouts.rs Regenerated: adds NodeId layout assertions and required imports.
crates/oxc_ast_macros/src/generated/structs.rs Regenerated: includes NodeId in the struct-details map.

@overlookmotel overlookmotel added C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior A-ast-tools Area - AST tools labels Apr 23, 2026
@overlookmotel
overlookmotel force-pushed the om/02-14-refactor_ast_tools_include_nodeid_in_ast_schema branch from fe9b1f7 to 7e96340 Compare April 23, 2026 13:56
@graphite-app

graphite-app Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Merge activity

Simplify treatment of `NodeId` in `ast_tools` codegen.

Add `#[ast]` attr to the type, and allow codegen to discover it, rather than hard-coding it into codegen as a "primitive" type.

This matches how `SymbolId`, `ScopeId` and `ReferenceId` are treated.

Does not alter generated code, only the means by which it's generated.
@graphite-app
graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_include_nodeid_in_ast_schema branch from 7e96340 to 58b3e46 Compare April 23, 2026 15:34
@graphite-app
graphite-app Bot merged commit 58b3e46 into main Apr 23, 2026
36 checks passed
@graphite-app
graphite-app Bot deleted the om/02-14-refactor_ast_tools_include_nodeid_in_ast_schema branch April 23, 2026 15:43
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