fix corner case in collapse_vars (#4909)

fixes #4908
This commit is contained in:
Alex Lam S.L
2021-05-04 09:33:52 +01:00
committed by GitHub
parent ce3c35fa8b
commit 3094eaaa89
3 changed files with 28 additions and 3 deletions

View File

@@ -9049,7 +9049,7 @@ issue_4874: {
}
expect: {
var a;
null;
a = null;
(function(b) {
for (var c in a && a[console.log("PASS")])
console;
@@ -9107,3 +9107,26 @@ issue_4895: {
}
expect_stdout: "42 42"
}
issue_4908: {
options = {
collapse_vars: true,
join_vars: true,
reduce_vars: true,
toplevel: true,
}
input: {
var a = 0;
var b;
console || a++;
var c = d = a, d = [ c && c, d += 42 ];
console.log(d[1]);
}
expect: {
var a = 0, b;
console || a++;
var c = d = a, d = [ d && d, d += 42 ];
console.log(d[1]);
}
expect_stdout: "42"
}