fix corner case in evaluate (#3936)

fixes #3935
This commit is contained in:
Alex Lam S.L
2020-05-29 15:10:36 +01:00
committed by GitHub
parent 60c0bc1e6b
commit 43498769f0
2 changed files with 16 additions and 1 deletions

View File

@@ -3430,7 +3430,7 @@ merge(Compressor.prototype, {
var v = e._eval(compressor, ignore_side_effects, cached, depth + 1);
if (v === e) return this;
modified(e);
return v;
return +v;
});
var non_converting_binary = makePredicate("&& || === !==");
def(AST_Binary, function(compressor, ignore_side_effects, cached, depth) {

View File

@@ -2654,3 +2654,18 @@ issue_3933: {
}
expect_stdout: "PASS"
}
issue_3935: {
options = {
evaluate: true,
}
input: {
console.log(function f(a) {
return a++;
}());
}
expect: {
console.log(NaN);
}
expect_stdout: "NaN"
}