fix corner case in evaluate (#4553)

fixes #4552
This commit is contained in:
Alex Lam S.L
2021-01-13 14:17:24 +00:00
committed by GitHub
parent e84957e3da
commit 24917e7084
2 changed files with 38 additions and 4 deletions

View File

@@ -3142,3 +3142,36 @@ issue_4480: {
}
expect_stdout: "PASS"
}
issue_4552: {
options = {
evaluate: true,
keep_fnames: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a = function f(b) {
return function() {
b++;
try {
return b;
} catch (e) {}
}();
}();
console.log(a);
}
expect: {
var a = function f(b) {
return function() {
b++;
try {
return b;
} catch (e) {}
}();
}();
console.log(a);
}
expect_stdout: "NaN"
}