Skip to content

refactor(ast): re-organise #[ast] macro implementation#23045

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/06-07-refactor_ast_re-organise_ast_macro_implementation
Jun 8, 2026
Merged

refactor(ast): re-organise #[ast] macro implementation#23045
graphite-app[bot] merged 1 commit into
mainfrom
om/06-07-refactor_ast_re-organise_ast_macro_implementation

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Jun 7, 2026

Copy link
Copy Markdown
Member

Refactor. Just re-organise implementation of #[ast] macro, to make the changes in next PR work better.

The only behavioral change is that we now omit some pointless attributes which were being added to #[ast(foreign = ...)] types. These types are just dummies, only used to communicate the layout of foreign types to the codegen, not used in actual code, so these extra attributes we were adding previously were dead weight.

overlookmotel commented Jun 7, 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 Jun 7, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 57 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing om/06-07-refactor_ast_re-organise_ast_macro_implementation (c6282d4) with main (388af9d)

Open in CodSpeed

Footnotes

  1. 9 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.

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 the #[ast] proc-macro implementation for structs by splitting the logic into a fallible internal helper (modify_struct_impl) and a small wrapper (modify_struct) that converts internal errors into compile_error! output. This is intended to reorganize the macro implementation to better support upcoming changes.

Changes:

  • Introduces modify_struct_impl(...) -> Result<TokenStream, &'static str> and makes modify_struct an error-wrapping front-end.
  • Moves STRUCTS lookup out of reorder_struct_fields by passing &StructDetails directly.
  • Keeps the main (non-foreign) struct transformation flow (reorder → repr → derive Ast → assertions) within the new helper.

Comment thread crates/oxc_ast_macros/src/ast.rs
@overlookmotel overlookmotel self-assigned this Jun 7, 2026
@graphite-app graphite-app Bot changed the base branch from om/06-07-refactor_linter_typescript_explicit_module_boundary_types_do_not_construct_identifiername_ to graphite-base/23045 June 7, 2026 07:20
@graphite-app graphite-app Bot force-pushed the graphite-base/23045 branch from 4136a3d to 388af9d Compare June 7, 2026 07:25
@graphite-app graphite-app Bot force-pushed the om/06-07-refactor_ast_re-organise_ast_macro_implementation branch from d782fda to 65e49a1 Compare June 7, 2026 07:25
@graphite-app graphite-app Bot changed the base branch from graphite-base/23045 to main June 7, 2026 07:26
@graphite-app graphite-app Bot force-pushed the om/06-07-refactor_ast_re-organise_ast_macro_implementation branch from 65e49a1 to c6282d4 Compare June 7, 2026 07:26
@graphite-app graphite-app Bot added the 0-merge Merge with Graphite Merge Queue label Jun 8, 2026
@graphite-app

graphite-app Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Merge activity

Refactor. Just re-organise implementation of `#[ast]` macro, to make the changes in next PR work better.

The only behavioral change is that we now omit some pointless attributes which were being added to `#[ast(foreign = ...)]` types. These types are just dummies, only used to communicate the layout of foreign types to the codegen, not used in actual code, so these extra attributes we were adding previously were dead weight.
@graphite-app graphite-app Bot force-pushed the om/06-07-refactor_ast_re-organise_ast_macro_implementation branch from c6282d4 to da2d911 Compare June 8, 2026 09:48
@graphite-app graphite-app Bot merged commit da2d911 into main Jun 8, 2026
29 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jun 8, 2026
@graphite-app graphite-app Bot deleted the om/06-07-refactor_ast_re-organise_ast_macro_implementation branch June 8, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants