fix corner case in reduce_vars (#5099)

fixes #5098
This commit is contained in:
Alex Lam S.L
2021-07-24 00:10:14 +01:00
committed by GitHub
parent 6a3fe9d1df
commit 657d525c80
2 changed files with 34 additions and 1 deletions

View File

@@ -6535,3 +6535,33 @@ issue_5096_4: {
}
expect_stdout: "PASS"
}
issue_5098: {
options = {
reduce_vars: true,
unused: true,
}
input: {
(function(o) {
function f() {
f = console.log;
if (o.p++)
throw "FAIL";
f("PASS");
}
return f;
})({ p: 0 })();
}
expect: {
(function(o) {
function f() {
f = console.log;
if (o.p++)
throw "FAIL";
f("PASS");
}
return f;
})({ p: 0 })();
}
expect_stdout: "PASS"
}