From 657d525c80e611df9a78812e4b6a35a3eb24d8f4 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 24 Jul 2021 00:10:14 +0100 Subject: fix corner case in `reduce_vars` (#5099) fixes #5098 --- test/compress/functions.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/compress/functions.js b/test/compress/functions.js index ff727da4..ccfb3044 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -6535,3 +6535,33 @@ issue_5096_4: { } expect_stdout: "PASS" } + +issue_5098: { + options = { + reduce_vars: true, + unused: true, + } + input: { + (function(o) { + function f() { + f = console.log; + if (o.p++) + throw "FAIL"; + f("PASS"); + } + return f; + })({ p: 0 })(); + } + expect: { + (function(o) { + function f() { + f = console.log; + if (o.p++) + throw "FAIL"; + f("PASS"); + } + return f; + })({ p: 0 })(); + } + expect_stdout: "PASS" +} -- cgit v1.2.3