From 8d668c2963c4322fea47009b057791c1a7caa612 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 20 Feb 2021 03:13:15 +0000 Subject: fix corner case in `conditionals` & `side_effects` (#4669) fixes #4668 --- test/compress/side_effects.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/compress') diff --git a/test/compress/side_effects.js b/test/compress/side_effects.js index 177cf503..994e884c 100644 --- a/test/compress/side_effects.js +++ b/test/compress/side_effects.js @@ -506,3 +506,34 @@ issue_4366_2: { expect_stdout: "PASS" node_version: ">=4" } + +issue_4668: { + options = { + conditionals: true, + keep_fargs: false, + keep_fnames: true, + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + function f(a) { + var b, c; + function g() { + return a = 0 + a, !d || (a = 0); + } + c = g(); + } + console.log(f()); + var d = 0; + } + expect: { + console.log(function f() { + (function g() { + 0; + })(); + }()); + } + expect_stdout: "undefined" +} -- cgit v1.2.3