Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(visit): Introduce Pass API and adjust visitor APIs for it #9680

Merged
merged 187 commits into from
Oct 29, 2024

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Oct 25, 2024

Migration guide

Please see swc-project/plugins#355 for an example upgrade.

Description:

  • Pass: FnMut(&mut Program).

Breaking Changes:

  • chain!: Use a tuple instead. You can replace all chain!( with ( with IDE feature and it will work.
  • chain! with 13 or more args: Use nested tuples for items after 13th element.
  • Replace -> impl Fold with -> impl Pass in general.
  • as_folder is now visit_mut_pass and it now returns impl VisitMut + Pass instead of impl VisitMut + Fold.
  • Program.apply and Program.mutate can be used to apply Pass to program. fn apply(self, impl Pass) -> Self; and fn mutate(&mut self, impl Pass).
  • noop() => noop_pass(). The new noop_pass function lives in swc_ecma_ast and it's a real noop function.

Related issue:

@kdy1 kdy1 requested review from a team as code owners October 27, 2024 21:56
kodiakhq[bot]
kodiakhq bot previously approved these changes Oct 27, 2024
kodiakhq[bot]
kodiakhq bot previously approved these changes Oct 27, 2024
@kdy1 kdy1 enabled auto-merge (squash) October 27, 2024 21:58
kodiakhq[bot]
kodiakhq bot previously approved these changes Oct 27, 2024
kodiakhq[bot]
kodiakhq bot previously approved these changes Oct 29, 2024
kodiakhq[bot]
kodiakhq bot previously approved these changes Oct 29, 2024
@kdy1 kdy1 disabled auto-merge October 29, 2024 02:25
@kdy1 kdy1 merged commit 581aafb into swc-project:main Oct 29, 2024
145 of 151 checks passed
@kdy1 kdy1 deleted the visitor-api branch October 29, 2024 02:25
@kdy1 kdy1 modified the milestones: Planned, v1.7.41 Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant