diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-10-01 03:01:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-01 03:01:50 +0800 |
commit | dd71639264f201902e08d078fcef1946eaad2ef3 (patch) | |
tree | 0a36136a11b3e0239cffaff9cf80e969e8068388 /test/compress/reduce_vars.js | |
parent | 2dcc552ce0404db3cdabb1dd02c8fff5c8dfc4f9 (diff) | |
download | tracifyjs-dd71639264f201902e08d078fcef1946eaad2ef3.tar.gz tracifyjs-dd71639264f201902e08d078fcef1946eaad2ef3.zip |
enhance `reduce_vars` for `AST_Accessor` (#2339)
fixes #2336
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r-- | test/compress/reduce_vars.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 556bcad2..4e096d9d 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -2549,7 +2549,7 @@ issue_1922_2: { expect_stdout: "1" } -accessor: { +accessor_1: { options = { evaluate: true, reduce_vars: true, @@ -2578,6 +2578,33 @@ accessor: { expect_stdout: "1 1" } +accessor_2: { + options = { + collapse_vars: true, + evaluate: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var A = 1; + var B = { + get c() { + console.log(A); + } + }; + B.c; + } + expect: { + ({ + get c() { + console.log(1); + } + }).c; + } + expect_stdout: "1" +} + for_in_prop: { options = { reduce_vars: true, |