Skip to content

refactor(ast_tools): remove special-case logic for NodeId from CloneIn generator#21675

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator
Apr 23, 2026
Merged

refactor(ast_tools): remove special-case logic for NodeId from CloneIn generator#21675
graphite-app[bot] merged 1 commit intomainfrom
om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 23, 2026

Simplify CloneIn generator in ast_tools.

Previously it had "special case" code for NodeId. Instead, implement CloneIn and Default on NodeId, and then node_id: Cell<NodeId> fields can be treated the same as any other field.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 23, 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator (94772d0) with main (3d1e83a)

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:55
Copilot AI review requested due to automatic review settings April 23, 2026 12:55
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 simplifies the CloneIn derive generator in tasks/ast_tools by removing hard-coded special-casing for node_id fields, and instead relies on NodeId being Default plus schema-driven #[clone_in(default)] handling.

Changes:

  • Removed node_id special-cases from the CloneIn generator (both clone_in and clone_in_with_semantic_ids paths).
  • Marked NodeId as #[clone_in(default)] and added Default/CloneIn impls for it.
  • Updated generated AST CloneIn impls to use Default::default() for node_id and generic CloneIn::clone_in_with_semantic_ids for semantic cloning.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
tasks/ast_tools/src/derives/clone_in.rs Removes special-case node_id handling and relies on schema-driven defaults + generic CloneIn calls.
crates/oxc_syntax/src/node.rs Adds #[clone_in(default)], Default, and CloneIn for NodeId to support the generator change.
crates/oxc_ast/src/generated/derive_clone_in.rs Regenerated output reflecting the new defaulting/copy behavior for node_id.

Comment thread crates/oxc_syntax/src/node.rs
@overlookmotel overlookmotel added C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior A-ast Area - AST A-ast-tools Area - AST tools labels Apr 23, 2026
@overlookmotel overlookmotel force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_get_id_generator branch from 6d2b863 to c79befa Compare April 23, 2026 13:56
@overlookmotel overlookmotel force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator branch from cabcc3c to f368805 Compare April 23, 2026 13:56
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 23, 2026

Merge activity

@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_get_id_generator branch from c79befa to 634486d Compare April 23, 2026 15:35
graphite-app Bot pushed a commit that referenced this pull request Apr 23, 2026
…neIn` generator (#21675)

Simplify `CloneIn` generator in `ast_tools`.

Previously it had "special case" code for `NodeId`. Instead, implement `CloneIn` and `Default` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator branch from f368805 to d8fc207 Compare April 23, 2026 15:36
@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_get_id_generator branch from 634486d to c4a29bb Compare April 23, 2026 15:45
graphite-app Bot pushed a commit that referenced this pull request Apr 23, 2026
…neIn` generator (#21675)

Simplify `CloneIn` generator in `ast_tools`.

Previously it had "special case" code for `NodeId`. Instead, implement `CloneIn` and `Default` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator branch from d8fc207 to 773bd50 Compare April 23, 2026 15:46
@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_get_id_generator branch from c4a29bb to 66f735a Compare April 23, 2026 17:19
graphite-app Bot pushed a commit that referenced this pull request Apr 23, 2026
…neIn` generator (#21675)

Simplify `CloneIn` generator in `ast_tools`.

Previously it had "special case" code for `NodeId`. Instead, implement `CloneIn` and `Default` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator branch from 773bd50 to 4ab852a Compare April 23, 2026 17:20
Base automatically changed from om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_get_id_generator to main April 23, 2026 17:26
…neIn` generator (#21675)

Simplify `CloneIn` generator in `ast_tools`.

Previously it had "special case" code for `NodeId`. Instead, implement `CloneIn` and `Default` on `NodeId`, and then `node_id: Cell<NodeId>` fields can be treated the same as any other field.
@graphite-app graphite-app Bot force-pushed the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator branch from 4ab852a to 94772d0 Compare April 23, 2026 17:28
@graphite-app graphite-app Bot merged commit 94772d0 into main Apr 23, 2026
36 checks passed
@graphite-app graphite-app Bot deleted the om/02-14-refactor_ast_tools_remove_special-case_logic_for_nodeid_from_clonein_generator branch April 23, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST 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