enhance collapse_vars (#3896)

This commit is contained in:
Alex Lam S.L
2020-05-14 00:52:42 +01:00
committed by GitHub
parent fe2f1965d6
commit 938368ba21
2 changed files with 39 additions and 6 deletions

View File

@@ -8015,3 +8015,38 @@ issue_3891: {
}
expect_stdout: "function"
}
issue_3894: {
options = {
collapse_vars: true,
inline: true,
reduce_vars: true,
unused: true,
}
input: {
function log(msg) {
console.log(msg ? "FAIL" : "PASS");
}
var a, c;
(function(b) {
a = c = 0,
log(b);
})(-0);
log(a);
log(c);
}
expect: {
function log(msg) {
console.log(msg ? "FAIL" : "PASS");
}
var a, c;
void log(-(a = c = 0));
log(a);
log(c);
}
expect_stdout: [
"PASS",
"PASS",
"PASS",
]
}