fix corner case in unused (#4134)

fixes #4133
This commit is contained in:
Alex Lam S.L
2020-09-20 16:21:59 +01:00
committed by GitHub
parent ef3831437d
commit 90410f9fc3
2 changed files with 27 additions and 3 deletions

View File

@@ -2924,3 +2924,24 @@ forin_var_2: {
}
expect_stdout: "undefined"
}
issue_4133: {
options = {
evaluate: true,
merge_vars: true,
pure_getters: "strict",
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a = 1;
var b = [ a-- ], c = b && b[c];
console.log(a);
}
expect: {
var b = 1;
console.log(0);
}
expect_stdout: "0"
}