-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(es/compat): Fix generator transform for compound assignments, for-in, and labeled break #11339
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
Conversation
🦋 Changeset detectedLatest commit: 51ca02a The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Binary Sizes
Commit: f0d9ac3 |
CodSpeed Performance ReportMerging #11339 will not alter performanceComparing Summary
|
There was a problem hiding this 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 fixes critical bugs in the ES2015 generator transform for compound assignments, for-in loops, and labeled break statements. The changes ensure proper code generation when these constructs are used with generators and async functions that are compiled to ES5.
Key changes:
- Fixed compound assignments with yield expressions to properly cache the left-hand side value before evaluation
- Enhanced for-in loop transformation to handle property deletion during iteration
- Corrected labeled break statement resolution to only match LabeledBlocks
Reviewed changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/swc_ecma_compat_es2015/src/generator.rs | Core fix for compound assignments, for-in loops, and labeled break handling |
| crates/swc_ecma_transforms_base/src/helpers/_ts_generator.js | Updated generator helper to use Object.defineProperty for better compatibility |
| packages/helpers/esm/_ts_generator.js | Forked version of _ts_generator helper with Object.defineProperty |
| packages/helpers/scripts/ast_grep.js | Updated build script to exclude forked _ts_generator from tslib import rewriting |
| packages/helpers/.dprint.json | Excluded _ts_generator files from formatting |
| Multiple test files | Added comprehensive test cases for all fixed issues |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Wow... I'll review your PRs after the trip. Sorry for the delay. |
Description:
BREAKING CHANGE:
Related issue (if exists):