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
Preserve empty for...of loops #3132
Conversation
src/ast/nodes/ForOfStatement.ts
Outdated
// this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, options))) || | ||
// (this.right && this.right.hasEffects(options)) || | ||
// this.body.hasEffects(options.setIgnoreBreakStatements()) | ||
// ); |
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.
Could you get rid of the commented code and commented import?
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.
Looks good, just get rid of the commented code, we always have git to restore it.
: { done: true }; | ||
|
||
// assert later | ||
global.foo = this.current; |
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.
A cooler way than mutating a global and testing our test isolation would be to export a mutable export let ...
binding and checking that.
Also, I fear to greater part of work would be to adapt the existing test suite |
Codecov Report
@@ Coverage Diff @@
## master #3132 +/- ##
==========================================
- Coverage 89.32% 89.32% -0.01%
==========================================
Files 165 165
Lines 5732 5731 -1
Branches 1741 1740 -1
==========================================
- Hits 5120 5119 -1
Misses 379 379
Partials 233 233
Continue to review full report at Codecov.
|
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.
Looks great!
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers: fixes #3126
Description
Since there is no proper support for Symbol.Iterator, drop the side effect (but don't remove) the algorithm such that iterators with side-effects are not omitted.