fix corner case in unused (#3517)

fixes #3515
This commit is contained in:
Alex Lam S.L
2019-10-23 01:58:40 +08:00
committed by GitHub
parent a53ab99378
commit 267bc70d33
2 changed files with 28 additions and 1 deletions

View File

@@ -2102,3 +2102,28 @@ issue_3497: {
}
expect_stdout: "undefined"
}
issue_3515: {
options = {
collapse_vars: true,
reduce_vars: true,
unused: true,
}
input: {
var c = 0;
(function() {
this[c++] = 0;
var expr20 = !0;
for (var key20 in expr20);
})();
console.log(c);
}
expect: {
var c = 0;
(function() {
for (var key20 in !(this[c++] = 0));
})();
console.log(c);
}
expect_stdout: "1"
}