diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-10-30 06:34:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-30 06:34:54 +0800 |
commit | f1eb03f2c0f860a963b2f61c5f8565d8703a18cb (patch) | |
tree | e03cc18f5043bef0f2632a681ffb1865337955f9 /test | |
parent | 0f4cfa877a9f14a75b219c04947ce5984772d8ba (diff) | |
download | tracifyjs-f1eb03f2c0f860a963b2f61c5f8565d8703a18cb.tar.gz tracifyjs-f1eb03f2c0f860a963b2f61c5f8565d8703a18cb.zip |
enhance `dead_code` (#3551)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/dead-code.js | 29 | ||||
-rw-r--r-- | test/compress/drop-unused.js | 34 |
2 files changed, 63 insertions, 0 deletions
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index 190a3243..501d55ec 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -1013,3 +1013,32 @@ issue_3406: { } expect_stdout: "true" } + +function_assign: { + options = { + dead_code: true, + } + input: { + console.log(function() { + var a = "PASS"; + function h(c) { + return c; + } + h.p = function(b) { + return b; + }.p = a; + return h; + }().p); + } + expect: { + console.log(function() { + var a = "PASS"; + function h(c) { + return c; + } + h.p = a; + return h; + }().p); + } + expect_stdout: "PASS" +} diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index f77072b0..7cb2e899 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2187,3 +2187,37 @@ issue_3515_3: { } expect_stdout: "PASS" } + +function_assign: { + options = { + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + unused: true, + } + input: { + console.log(function() { + var a = "PASS"; + function g(b) { + return b; + } + g.p = a; + function h(c) { + return c; + } + h.p = a; + return h; + }().p); + } + expect: { + console.log(function() { + var a = "PASS"; + function h(c) { + return c; + } + h.p = a; + return h; + }().p); + } + expect_stdout: "PASS" +} |