Skip to content

refactor(ast_tools): re-vamp oxc_ast_tools#8844

Merged
Boshen merged 1 commit intomainfrom
02-02-refactor_ast_tools_re-vamp_oxc_ast_tools_
Feb 3, 2025
Merged

refactor(ast_tools): re-vamp oxc_ast_tools#8844
Boshen merged 1 commit intomainfrom
02-02-refactor_ast_tools_re-vamp_oxc_ast_tools_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 2, 2025

Large refactor of oxc_ast_tools. This barely alters the generated code which oxc_ast_tools produces, but it overhauls its internals significantly.

Notable changes:

  • Code and types are much simplified.
  • Fully documented.
  • Schema is the single source of truth for information about the AST. Generators don't have to deal with the complicated syn types.
  • Vecs, Options, Boxes, and primitive types have their own entries in the schema.
  • Co-locate logic for custom attributes (e.g. #[visit]) with the generators which use those attributes.
  • Helpers for parsing attributes, and other common actions.
  • Fix logic for calculating type layouts, correctly calculating niches.
  • Generation runs in parallel with rayon.

Overall intent is to make maintaining/modifying the existing generators, and adding new ones, much easier. The complex logic of parsing types etc is abstracted away into the "framework" of oxc_ast_tools, leaving the generators themselves simpler to write and easier to reason about.

Copy link
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 hot fixes, skip the queue and merge this PR next

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 Area - AST A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Feb 2, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 2, 2025

CodSpeed Performance Report

Merging #8844 will not alter performance

Comparing 02-02-refactor_ast_tools_re-vamp_oxc_ast_tools_ (1450dca) with main (9c84c6d)

Summary

✅ 33 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review February 2, 2025 16:50
@overlookmotel overlookmotel force-pushed the 02-02-refactor_ast_tools_re-vamp_oxc_ast_tools_ branch from 7d2807a to 798041a Compare February 2, 2025 16:53
@overlookmotel overlookmotel force-pushed the 02-02-refactor_ast_tools_re-vamp_oxc_ast_tools_ branch from 798041a to 1450dca Compare February 2, 2025 17:06
@Boshen Boshen merged commit a5bdf32 into main Feb 3, 2025
29 checks passed
@Boshen Boshen deleted the 02-02-refactor_ast_tools_re-vamp_oxc_ast_tools_ branch February 3, 2025 04:08
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