diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-07-05 19:43:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 02:43:09 +0800 |
commit | d0e3f6955d956a4977d701e9027eb54d15b6f77c (patch) | |
tree | 868f95638628a5b5d79a306bf1a5ee1e5afe7360 /test | |
parent | 6961c57d1e2849b4c7c9e43295015d0bee44daa5 (diff) | |
download | tracifyjs-d0e3f6955d956a4977d701e9027eb54d15b6f77c.tar.gz tracifyjs-d0e3f6955d956a4977d701e9027eb54d15b6f77c.zip |
enhance `functions` (#5052)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 6e75e8fb..6d41a265 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -2826,6 +2826,36 @@ functions_use_strict: { expect_stdout: "a true 42 function function function" } +functions_cross_scope_reference: { + options = { + functions: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + log = function(fn) { + console.log(typeof fn()); + }; + var a = function() {}; + function f() { + return a; + } + while (log(f)); + } + expect: { + log = function(fn) { + console.log(typeof fn()); + }; + function a() {} + function f() { + return a; + } + while (log(f)); + } + expect_stdout: "function" +} + functions_inner_var: { options = { functions: true, |