fix corner case in evaluate (#3739)

fixes #3738
This commit is contained in:
Alex Lam S.L
2020-03-01 20:34:31 +00:00
committed by GitHub
parent 3485472866
commit a051846d22
2 changed files with 14 additions and 2 deletions

View File

@@ -2528,9 +2528,8 @@ merge(Compressor.prototype, {
return left.is_negative_zero() || right.is_negative_zero(); return left.is_negative_zero() || right.is_negative_zero();
case "*": case "*":
case "/": case "/":
return true;
case "%": case "%":
return left.is_negative_zero(); return true;
default: default:
return false; return false;
} }

View File

@@ -2161,3 +2161,16 @@ collapse_vars_regexp: {
"abbb", "abbb",
] ]
} }
issue_3738: {
options = {
evaluate: true,
}
input: {
console.log(1 / (0 + ([] - 1) % 1));
}
expect: {
console.log(1 / (0 + ([] - 1) % 1));
}
expect_stdout: "Infinity"
}