fix corner case in unsafe_math (#3594)

fixes #3593
This commit is contained in:
Alex Lam S.L
2019-11-18 13:44:13 +08:00
committed by GitHub
parent 8504a4ea0e
commit 644f65feca
2 changed files with 45 additions and 33 deletions

View File

@@ -870,7 +870,7 @@ issue_3547_3: {
a + "21",
a + "2" - 1,
a - 1,
a - "2" - 1,
a - 3,
].forEach(function(n) {
console.log(typeof n, n);
});
@@ -904,7 +904,7 @@ issue_3547_4: {
[
"3" + a + 1,
"3" + a - 1,
"3" - a + 1,
4 - a,
2 - a,
].forEach(function(n) {
console.log(typeof n, n);
@@ -931,3 +931,17 @@ unsafe_math_rounding: {
}
expect_stdout: "false"
}
issue_3593: {
options = {
evaluate: true,
unsafe_math: true,
}
input: {
console.log((0 === this) - 1 - "1");
}
expect: {
console.log((0 === this) - 2);
}
expect_stdout: "-2"
}