fix corner case in reduce_vars (#5121)

fixes #5120
This commit is contained in:
Alex Lam S.L
2021-08-25 03:39:35 +01:00
committed by GitHub
parent db94d21980
commit c3aef23614
3 changed files with 41 additions and 13 deletions

View File

@@ -6600,3 +6600,32 @@ shorter_without_void: {
"baz",
]
}
issue_5120: {
options = {
functions: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a = function f() {
function g() {
f || g();
}
g();
return f.valueOf();
};
console.log(a() === a ? "PASS" : "FAIL");
}
expect: {
function a() {
(function g() {
a || g();
})();
return a.valueOf();
}
console.log(a() === a ? "PASS" : "FAIL");
}
expect_stdout: "PASS"
}