fix corner case in collapse_vars (#4287)

fixes #4286
This commit is contained in:
Alex Lam S.L
2020-11-17 10:03:31 +00:00
committed by GitHub
parent 8a83c8dd46
commit 383163afa6
2 changed files with 43 additions and 15 deletions

View File

@@ -1403,3 +1403,40 @@ issue_4284_3: {
expect_stdout: "PASS"
node_version: ">=6"
}
issue_4286_1: {
options = {
collapse_vars: true,
toplevel: true,
}
input: {
var a = "PASS", b;
(0 && a)[{ a } = b = a];
console.log(b);
}
expect: {
var a = "PASS", b;
(0 && a)[{ a } = b = a];
console.log(b);
}
expect_stdout: "PASS"
node_version: ">=6"
}
issue_4286_2: {
options = {
collapse_vars: true,
toplevel: true,
}
input: {
a = [ "PASS" ];
var b, { a } = b = a;
console.log(b[0]);
}
expect: {
var b, { a } = b = a = [ "PASS" ];
console.log(b[0]);
}
expect_stdout: "PASS"
node_version: ">=6"
}