diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-17 21:33:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 21:33:13 +0800 |
commit | 07e4b64f3a8439a9491cc7a277872e0a5d79a29b (patch) | |
tree | 6a2be087889003300ea1a17fcef7ce6ecf197c6b /test/compress/reduce_vars.js | |
parent | d3ce2bc9e73d9d98b34b261d282a18b9ce9d5880 (diff) | |
download | tracifyjs-07e4b64f3a8439a9491cc7a277872e0a5d79a29b.tar.gz tracifyjs-07e4b64f3a8439a9491cc7a277872e0a5d79a29b.zip |
fix `AST_Scope.clone()` (#2803)
fixes #2799
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r-- | test/compress/reduce_vars.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index ec0471a8..33175d1b 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -5302,3 +5302,61 @@ issue_2774: { } expect_stdout: "undefined" } + +issue_2799_1: { + options = { + reduce_funcs: true, + reduce_vars: true, + unused: true, + } + input: { + console.log(function() { + return f; + function f(n) { + function g(i) { + return i && i + g(i - 1); + } + function h(j) { + return g(j); + } + return h(n); + } + }()(5)); + } + expect: { + console.log(function() { + return function(n) { + return function(j) { + return function g(i) { + return i && i + g(i - 1); + }(j); + }(n); + } + }()(5)); + } + expect_stdout: "15" +} + +issue_2799_2: { + options = { + reduce_vars: true, + unsafe_proto: true, + unused: true, + } + input: { + (function() { + function foo() { + Function.prototype.call.apply(console.log, [ null, "PASS" ]); + } + foo(); + })(); + } + expect: { + (function() { + (function() { + (function() {}).call.apply(console.log, [ null, "PASS" ]); + })(); + })(); + } + expect_stdout: "PASS" +} |