diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-11-05 19:55:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 03:55:25 +0800 |
commit | c2f6fd5fded46624da3851e3accc3b5165e6d588 (patch) | |
tree | 3f09f968b442df51362d1bf70bb377b16bf216b6 /test | |
parent | af4ea3ff6978f079531d011cffc7e2337b3ab48c (diff) | |
download | tracifyjs-c2f6fd5fded46624da3851e3accc3b5165e6d588.tar.gz tracifyjs-c2f6fd5fded46624da3851e3accc3b5165e6d588.zip |
fix corner case in `functions` (#4260)
fixes #4259
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 26 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 4ed0dc1b..c2ab23f6 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -5115,3 +5115,29 @@ issue_4233: { } expect_stdout: "number" } + +issue_4259: { + options = { + collapse_vars: true, + functions: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = function b() { + var c = b; + for (b in c); + }; + a(); + console.log(typeof a); + } + expect: { + function a() { + for (a in a); + } + a(); + console.log(typeof a); + } + expect_stdout: "function" +} diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index ea3703c1..838b130a 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -1999,7 +1999,7 @@ issue_1606: { var a, b; function g(){}; b = 2; - x(b); + x(2); } } } |