No successful run was found on main (5aa9f05) during the generation of this report, so c388e87 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.
feat(es/transformer): Implement async-to-generator using VisitMutHook
This implements the async-to-generator transformation using the new VisitMutHook system in swc_ecma_transformer, replacing the old VisitMut-based implementation.
Key changes:
- Implemented AsyncToGeneratorPass using VisitMutHook<TraverseCtx>
- Added function state stack to properly handle nested async functions
- Transforms async functions/arrow functions to generator functions wrapped in asyncToGenerator helper
- Handles for-await-of loops
- Properly tracks `this`, `arguments`, and `super` usage
- Supports async generators with wrapAsyncGenerator helper
Test results: 146 out of 150 tests passing (4 known edge cases with constructor hoisting remain)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
5265b12
2 days ago
by kdy1
-2.81%
perf(es/transformer): Remove should_work checks from async-to-generator
Removed performance overhead from should_work checks in async-to-generator
transformation. The hook-based architecture already handles traversal
efficiently, making pre-checking unnecessary.
Changes:
- Removed should_work usage from exit_expr and exit_stmt
- Removed ShouldWork visitor struct and Check trait impl
- Simplified enter_constructor by removing should_work check
- All tests still pass (146/150)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
7604f75
2 days ago
by kdy1
+5.39%
refactor(es/transformer): Replace FnEnvHoister with direct this replacement
Replace FnEnvHoister usage with direct `this` to `_this` replacement for
async arrows in constructors. This approach is simpler and more reliable:
- Add `this_var` field to track the `_this` identifier
- Implement `replace_this_in_*` helper functions to recursively replace
`this` expressions with `_this` in arrow body
- In exit_constructor, directly create `var _this;` declaration and add
`_this = this` after super() call
- Remove FnEnvHoister usage for constructor context
This fixes issue_8452 and issue_9432 where async arrows using `this` in
constructors were not properly transformed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
e15bbfa
2 days ago
by kdy1
-0.22%
fix API
278c64e
2 days ago
by kdy1
+0.08%
ast
ec6ddc2
2 days ago
by kdy1
0%
Update swc dependencies in changeset
Updated package versions for swc dependencies to patch.