fix corner case in unsafe_math (#3677)

fixes #3676
This commit is contained in:
Alex Lam S.L
2020-01-08 10:28:10 +08:00
committed by GitHub
parent f5ceff6e4b
commit 14c35739dd
2 changed files with 35 additions and 1 deletions

View File

@@ -1135,3 +1135,35 @@ issue_3655: {
"0",
]
}
issue_3676_1: {
options = {
evaluate: true,
unsafe_math: true,
}
input: {
var a = [];
console.log(false - (a - (a[1] = 42)));
}
expect: {
var a = [];
console.log(false - (a - (a[1] = 42)));
}
expect_stdout: "NaN"
}
issue_3676_2: {
options = {
evaluate: true,
unsafe_math: true,
}
input: {
var a;
console.log(false - ((a = []) - (a[1] = 42)));
}
expect: {
var a;
console.log(false - ((a = []) - (a[1] = 42)));
}
expect_stdout: "NaN"
}