fix corner cases in collapse_vars & dead_code (#4052)

fixes #4051
This commit is contained in:
Alex Lam S.L
2020-08-16 22:54:27 +01:00
committed by GitHub
parent 45ab3b51d8
commit 23f0dca992
3 changed files with 50 additions and 3 deletions

View File

@@ -8447,3 +8447,22 @@ issue_4047_2: {
"NaN",
]
}
issue_4051: {
options = {
collapse_vars: true,
}
input: {
try {
var a = (b = b.p, "FAIL"), b = b;
} catch (e) {}
console.log(a);
}
expect: {
try {
var a = (b = b.p, "FAIL"), b = b;
} catch (e) {}
console.log(a);
}
expect_stdout: "undefined"
}

View File

@@ -1341,3 +1341,24 @@ issue_3967: {
}
expect_stdout: "PASS"
}
issue_4051: {
options = {
dead_code: true,
}
input: {
try {
delete (A = A);
} catch (e) {
console.log("PASS");
}
}
expect: {
try {
delete (A = A);
} catch (e) {
console.log("PASS");
}
}
expect_stdout: "PASS"
}