Do not unpack array patterns that update a referenced binding (#8535)
Fixes #8528
This commit is contained in:
committed by
Henry Zhu
parent
55faa27b93
commit
626f47982e
4
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/input.js
vendored
Normal file
4
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/input.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
function isBetween(x, a, b) {
|
||||
if (a > b) [a, b] = [b, a];
|
||||
return x > a && x < b;
|
||||
}
|
||||
3
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/options.json
vendored
Normal file
3
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-destructuring"]
|
||||
}
|
||||
9
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/output.js
vendored
Normal file
9
packages/babel-plugin-transform-destructuring/test/fixtures/regression/8528/output.js
vendored
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user