diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-04 15:53:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 15:53:53 +0800 |
commit | 7a6d452b548c8b7783b226f646e814d6cb0cf32b (patch) | |
tree | 69f30a000b07a4dc62d420002f25c5fb8648efba /test/compress | |
parent | 9b58b54e2d7ce4ab2c015611add52c7475de9eab (diff) | |
download | tracifyjs-7a6d452b548c8b7783b226f646e814d6cb0cf32b.tar.gz tracifyjs-7a6d452b548c8b7783b226f646e814d6cb0cf32b.zip |
preserve constant modification under strict mode (#2717)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/pure_getters.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js index 7185e0c6..80b0e8ea 100644 --- a/test/compress/pure_getters.js +++ b/test/compress/pure_getters.js @@ -348,6 +348,57 @@ set_immutable_4: { expect_stdout: true } +set_immutable_5: { + options = { + collapse_vars: true, + conditionals: true, + evaluate: true, + pure_getters: "strict", + reduce_funcs: true, + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + "use strict"; + var a = 1; + a.foo += ""; + if (a.foo) console.log("FAIL"); + else console.log("PASS"); + } + expect: { + "use strict"; + 1..foo += ""; + 1..foo ? console.log("FAIL") : console.log("PASS"); + } + expect_stdout: true +} + +set_immutable_6: { + options = { + collapse_vars: true, + conditionals: true, + evaluate: true, + pure_getters: "strict", + reduce_funcs: true, + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + var a = 1; + a.foo += ""; + if (a.foo) console.log("FAIL"); + else console.log("PASS"); + } + expect: { + 1..foo ? console.log("FAIL") : console.log("PASS"); + } + expect_stdout: true +} + set_mutable_1: { options = { collapse_vars: true, |