diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-10-22 20:10:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-22 20:10:13 +0800 |
commit | 24aa07855bc608f29cca2a58a40af1988256b116 (patch) | |
tree | 52428c6db4496e196b2837dbe7b73324e32558b5 /test/compress/collapse_vars.js | |
parent | 5fd723f14394b74f899e7b33bc9084317bf01d7d (diff) | |
download | tracifyjs-24aa07855bc608f29cca2a58a40af1988256b116.tar.gz tracifyjs-24aa07855bc608f29cca2a58a40af1988256b116.zip |
safer `properties` transform (#2391)
`{ a: x, b: y }.a` => `[ x, y ][0]`
- `x` cannot be function containing `this`
`[ x, y, z ][1]` => `(x, z, y)`
- only if `z` is side-effect-free
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r-- | test/compress/collapse_vars.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 52b2ddf8..1f702ad7 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -2534,73 +2534,6 @@ issue_2319_3: { expect_stdout: "true" } -prop_side_effects_1: { - options = { - collapse_vars: true, - evaluate: true, - pure_getters: "strict", - reduce_vars: true, - toplevel: true, - unsafe: true, - unused: true, - } - input: { - var C = 1; - console.log(C); - var obj = { - bar: function() { - return C + C; - } - }; - console.log(obj.bar()); - } - expect: { - console.log(1); - console.log({ - bar: function() { - return 2; - } - }.bar()); - } - expect_stdout: [ - "1", - "2", - ] -} - -prop_side_effects_2: { - options = { - collapse_vars: true, - evaluate: true, - inline: true, - passes: 2, - pure_getters: "strict", - reduce_vars: true, - side_effects: true, - toplevel: true, - unsafe: true, - unused: true, - } - input: { - var C = 1; - console.log(C); - var obj = { - bar: function() { - return C + C; - } - }; - console.log(obj.bar()); - } - expect: { - console.log(1); - console.log(2); - } - expect_stdout: [ - "1", - "2", - ] -} - issue_2365: { options = { collapse_vars: true, |