fix corner case in merge_vars & reduce_vars (#4313)

fixes #4312
This commit is contained in:
Alex Lam S.L
2020-11-21 00:57:59 +00:00
committed by GitHub
parent 8d30902ba9
commit cf120c7cea
3 changed files with 59 additions and 10 deletions

View File

@@ -1616,3 +1616,34 @@ issue_4308: {
expect_stdout: "PASS"
node_version: ">=6"
}
issue_4312: {
options = {
collapse_vars: true,
inline: true,
merge_vars: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a;
(function f(b, c) {
return function({
[a = b]: d,
}) {}(c && c);
})("PASS", "FAIL");
console.log(a);
}
expect: {
var a;
b = "PASS",
(function({
[a = b]: d,
}){})((c = "FAIL") && c);
var b, c;
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=6"
}