Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Destructuring empty in nested
for
expressions (#14841)
* fix * Update packages/babel-plugin-transform-destructuring/src/util.ts Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com> * review * review Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
- Loading branch information
1 parent
73d86fe
commit 614d98b
Showing
3 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...n-transform-destructuring/test/fixtures/destructuring/destructuring-empty-in-for/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
for ( let x in y ) for ( ; ; ) var { } = x ; | ||
|
||
for ( let x in y ) for ( var { } = x ; ; ) ; | ||
|
||
for ( let x in y ) for ( ; { } = x ; {} = x ) var { } = x ; |
19 changes: 19 additions & 0 deletions
19
...-transform-destructuring/test/fixtures/destructuring/destructuring-empty-in-for/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
for (var x in y) { | ||
for (;;) { | ||
babelHelpers.objectDestructuringEmpty(x); | ||
} | ||
} | ||
|
||
for (var _x in y) { | ||
for (babelHelpers.objectDestructuringEmpty(_x);;) { | ||
; | ||
} | ||
} | ||
|
||
for (var _x2 in y) { | ||
for (; _x3 = _x2, babelHelpers.objectDestructuringEmpty(_x3), _x3; _x4 = _x2, babelHelpers.objectDestructuringEmpty(_x4), _x4) { | ||
var _x3, _x4; | ||
|
||
babelHelpers.objectDestructuringEmpty(_x2); | ||
} | ||
} |