diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-06-04 19:27:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-04 19:27:43 +0800 |
commit | 540220b91bb02d50d04422dc782a5fe1905dd27a (patch) | |
tree | 738cb5d7e38ca06fa8c0aed681a448c78b5f9c85 /test/compress | |
parent | 84634da4b5e581c36686082b1071fdf646775f49 (diff) | |
download | tracifyjs-540220b91bb02d50d04422dc782a5fe1905dd27a.tar.gz tracifyjs-540220b91bb02d50d04422dc782a5fe1905dd27a.zip |
fix `AST_Function` scope invariance (#2052)
improve function name hack in `run_code()`
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/drop-unused.js | 12 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 39 |
2 files changed, 40 insertions, 11 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 2ef6f796..af792bfa 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -751,12 +751,12 @@ issue_1583: { expect: { function m(t) { (function(e) { - t = (function() { - return (function(a) { - return a; - })(function(a) {}); - })(); - })(); + t = e(); + })(function() { + return (function(a) { + return a; + })(function(a) {}); + }); } } } diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 2a44492a..078de82d 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -1311,19 +1311,48 @@ iife_func_side_effects: { unused: true, } input: { + function x() { + console.log("x"); + } + function y() { + console.log("y"); + } + function z() { + console.log("z"); + } (function(a, b, c) { - return b(); + function y() { + console.log("FAIL"); + } + return y + b(); })(x(), function() { return y(); }, z()); } expect: { + function x() { + console.log("x"); + } + function y() { + console.log("y"); + } + function z() { + console.log("z"); + } (function(a, b, c) { - return function() { - return y(); - }(); - })(x(), 0, z()); + function y() { + console.log("FAIL"); + } + return y + b(); + })(x(), function() { + return y(); + }, z()); } + expect_stdout: [ + "x", + "z", + "y", + ] } issue_1595_1: { |