fix & enhance unsafe_math (#3537)

closes #3535
fixes #3536
This commit is contained in:
Alex Lam S.L
2019-10-28 13:37:08 +08:00
committed by GitHub
parent 06e135e35f
commit 2f3b460212
3 changed files with 43 additions and 6 deletions

View File

@@ -713,7 +713,7 @@ issue_3531_1: {
}
expect: {
var a = "1";
console.log(typeof (a + 1 - (.2 + .1)));
console.log(typeof (a + 1 - .3));
}
expect_stdout: "number"
}
@@ -747,3 +747,21 @@ issue_3531_3: {
}
expect_stdout: "-22"
}
issue_3536: {
options = {
evaluate: true,
unsafe_math: true,
}
input: {
var a = 100, b = 10;
var c = --a + ("23" - (b++, 1));
console.log(typeof c, a, b, c);
}
expect: {
var a = 100, b = 10;
var c = --a + ("23" - (b++, 1));
console.log(typeof c, a, b, c);
}
expect_stdout: "number 99 11 121"
}