fix corner case in unused (#3599)

fixes #3598
This commit is contained in:
Alex Lam S.L
2019-11-19 04:26:41 +08:00
committed by GitHub
parent c289ba1139
commit 67278e76c8
2 changed files with 33 additions and 2 deletions

View File

@@ -2235,3 +2235,34 @@ function_assign: {
}
expect_stdout: "PASS"
}
issue_3598: {
options = {
collapse_vars: true,
reduce_vars: true,
unused: true,
}
input: {
var a = "FAIL";
try {
(function() {
var b = void 0;
a = "PASS";
c.p = 0;
var c = b[!1];
})();
} catch (e) {}
console.log(a);
}
expect: {
var a = "FAIL";
try {
(function() {
a = "PASS";
var c = (void (c.p = 0))[!1];
})();
} catch (e) {}
console.log(a);
}
expect_stdout: "PASS"
}