Do not unpack array patterns that update a referenced binding (#8535)

Fixes #8528
This commit is contained in:
Nicolò Ribaudo
2018-09-28 17:45:42 +02:00
committed by Henry Zhu
parent 55faa27b93
commit 626f47982e
4 changed files with 40 additions and 8 deletions

View File

@@ -0,0 +1,4 @@
function isBetween(x, a, b) {
if (a > b) [a, b] = [b, a];
return x > a && x < b;
}

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-destructuring"]
}

View 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;
}