Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not unpack array patterns that update a referenced binding (#8535)
Fixes #8528
- Loading branch information
1 parent
55faa27
commit 626f479
Showing
4 changed files
with
40 additions
and
8 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
4 changes: 4 additions & 0 deletions
4
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/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,4 @@ | ||
function isBetween(x, a, b) { | ||
if (a > b) [a, b] = [b, a]; | ||
return x > a && x < b; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/options.json
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,3 @@ | ||
{ | ||
"plugins": ["transform-destructuring"] | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/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,9 @@ | ||
function isBetween(x, a, b) { | ||
if (a > b) { | ||
var _ref = [b, a]; | ||
a = _ref[0]; | ||
b = _ref[1]; | ||
} | ||
|
||
return x > a && x < b; | ||
} |