From 76f40e25285e017d95780dac61e1f8fef395e8c2 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 12 May 2020 15:28:55 +0100 Subject: fix corner case in `collapse_vars` (#3892) fixes #3891 --- test/compress/collapse_vars.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test/compress/collapse_vars.js') 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" +} -- cgit v1.2.3