diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-11-05 22:14:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-05 22:14:11 +0800 |
commit | 2c2fd89e343626f8d7dc83812a6476b0ab99b784 (patch) | |
tree | 6a42beb30791bb9c35c98c6643e6e45a2e6bcc79 /test/compress/functions.js | |
parent | f46281e2b75a0cae0fbc591ba23c000d4106a07a (diff) | |
download | tracifyjs-2c2fd89e343626f8d7dc83812a6476b0ab99b784.tar.gz tracifyjs-2c2fd89e343626f8d7dc83812a6476b0ab99b784.zip |
inline single-use functions that are not constant expressions (#2434)
fixes #2428
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r-- | test/compress/functions.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index febf81c1..3c2ccce3 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -508,3 +508,41 @@ issue_2114_2: { } expect_stdout: "2" } + +issue_2428: { + options = { + collapse_vars: true, + inline: true, + passes: 2, + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + toplevel: true, + unsafe: true, + unused: true, + } + input: { + function bar(k) { + console.log(k); + } + function foo(x) { + return bar(x); + } + function baz(a) { + foo(a); + } + baz(42); + baz("PASS"); + } + expect: { + function baz(a) { + console.log(a); + } + baz(42); + baz("PASS"); + } + expect_stdout: [ + "42", + "PASS", + ] +} |