diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-05-12 15:28:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-12 22:28:55 +0800 |
commit | 76f40e25285e017d95780dac61e1f8fef395e8c2 (patch) | |
tree | b3d8a5b8a1078c6895f08e52b706d3e6763d2987 /test/compress/collapse_vars.js | |
parent | 8024f7f7a86023cf68f1f1b2496ec38c8bc200d8 (diff) | |
download | tracifyjs-76f40e25285e017d95780dac61e1f8fef395e8c2.tar.gz tracifyjs-76f40e25285e017d95780dac61e1f8fef395e8c2.zip |
fix corner case in `collapse_vars` (#3892)
fixes #3891
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r-- | test/compress/collapse_vars.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index ff0837a2..dee370cf 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -7979,3 +7979,39 @@ issue_3884: { } expect_stdout: "101 32" } + +issue_3891: { + options = { + collapse_vars: true, + passes: 2, + reduce_vars: true, + side_effects: true, + unused: true, + } + input: { + function log(a) { + console.log(typeof a); + } + log(function f() { + try { + do { + var b = function() {}(); + } while (f = 0, b.p); + } catch (e) { + var f; + b; + } + }); + } + expect: { + function log(a) { + console.log(typeof a); + } + log(function() { + try { + do {} while ((void 0).p); + } catch (e) {} + }); + } + expect_stdout: "function" +} |