diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-01-08 10:28:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-08 10:28:10 +0800 |
commit | 14c35739ddb1c0b181d8c54566171f217014b563 (patch) | |
tree | 4c24265ebc3e76fb44c7611c5d1204e9d224ef35 /test/compress | |
parent | f5ceff6e4b94a032078b0730f91662ee62758eb4 (diff) | |
download | tracifyjs-14c35739ddb1c0b181d8c54566171f217014b563.tar.gz tracifyjs-14c35739ddb1c0b181d8c54566171f217014b563.zip |
fix corner case in `unsafe_math` (#3677)
fixes #3676
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/numbers.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js index f49996a4..c40ca09d 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -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" +} |