diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-14 16:48:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 16:48:47 +0800 |
commit | d316fb139da73ce299cd90e22ec742fdebe87d04 (patch) | |
tree | 42b41daff6f49c85c76e10f5906ea46e9c90d1aa /test/compress/evaluate.js | |
parent | 83d8aa8b12ab7dc1854e6dc145f0cd96bf7d5bc9 (diff) | |
download | tracifyjs-d316fb139da73ce299cd90e22ec742fdebe87d04.tar.gz tracifyjs-d316fb139da73ce299cd90e22ec742fdebe87d04.zip |
fix `unsafe` `evaluate` on type-converting operators (#2917)
fixes #2916
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r-- | test/compress/evaluate.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index 41b599ed..3ac62ef5 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -1429,3 +1429,63 @@ string_case: { "199", ] } + +issue_2916_1: { + options = { + evaluate: true, + reduce_vars: true, + unsafe: true, + } + input: { + var c = "PASS"; + (function(a, b) { + (function(d) { + d[0] = 1; + })(b); + a == b && (c = "FAIL"); + })("", []); + console.log(c); + } + expect: { + var c = "PASS"; + (function(a, b) { + (function(d) { + d[0] = 1; + })(b); + a == b && (c = "FAIL"); + })("", []); + console.log(c); + } + expect_stdout: "PASS" +} + +issue_2916_2: { + options = { + collapse_vars: true, + evaluate: true, + inline: true, + reduce_vars: true, + side_effects: true, + unsafe: true, + unused: true, + } + input: { + var c = "FAIL"; + (function(b) { + (function(d) { + d[0] = 1; + })(b); + +b && (c = "PASS"); + })([]); + console.log(c); + } + expect: { + var c = "FAIL"; + (function(b) { + b[0] = 1; + +b && (c = "PASS"); + })([]); + console.log(c); + } + expect_stdout: "PASS" +} |