From 9a9543013c9d56cfc9593893fb9bfdff2aaa0307 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 16 Mar 2021 12:58:51 +0000 Subject: fix corner case in `functions` (#4789) fixes #4788 --- test/compress/functions.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test/compress/functions.js') diff --git a/test/compress/functions.js b/test/compress/functions.js index 68ff709b..e43efcea 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -5912,3 +5912,40 @@ issue_4753_2: { } expect_stdout: "PASS" } + +issue_4788: { + options = { + evaluate: true, + functions: true, + keep_fnames: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + function f() { + var a = function g() { + if (0) { + var g = 42; + f(); + } + g || console.log("PASS"); + }; + a(a); + } + f(); + } + expect: { + (function f() { + function a() { + if (0) { + var g = 42; + f(); + } + g || console.log("PASS"); + } + a(); + })(); + } + expect_stdout: "PASS" +} -- cgit v1.2.3