diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-04-21 23:30:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 06:30:08 +0800 |
commit | 9577c8c1b70699f8c1719117dd07df2bdeba7daa (patch) | |
tree | 2c101ecc93b2012053891cb85066ff9964219f62 /test/compress | |
parent | 925a0ca1a04c5c50f80378ce3f8f3c8a6c81d8b4 (diff) | |
download | tracifyjs-9577c8c1b70699f8c1719117dd07df2bdeba7daa.tar.gz tracifyjs-9577c8c1b70699f8c1719117dd07df2bdeba7daa.zip |
fix corner case in `conditionals` (#3809)
fixes #3808
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/conditionals.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js index 26f6b73e..ab9c4108 100644 --- a/test/compress/conditionals.js +++ b/test/compress/conditionals.js @@ -1759,3 +1759,37 @@ conditional_assignments_3: { } expect_stdout: "PASS" } + +issue_3808_1: { + options = { + conditionals: true, + side_effects: true, + } + input: { + var a; + a = "PASS", [] + "" && (a = "FAIL"); + console.log(a); + } + expect: { + var a; + a = [] + "" ? "FAIL" : "PASS"; + console.log(a); + } + expect_stdout: "PASS" +} + +issue_3808_2: { + options = { + conditionals: true, + side_effects: true, + } + input: { + var a; + console.log((a = "PASS", [] + "" && (a = "FAIL")), a); + } + expect: { + var a; + console.log((a = "PASS", [] + "" && (a = "FAIL")), a); + } + expect_stdout: " PASS" +} |