From 02308a7b5651ce04703fafc43887636642c5e888 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 22 Oct 2019 20:36:05 +0800 Subject: fix corner case in `reduce_vars` (#3510) fixes #3509 --- test/compress/reduce_vars.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/compress/reduce_vars.js') diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 744cdf1b..ce7c16da 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -6752,3 +6752,31 @@ issue_3377: { } expect_stdout: "42" } + +issue_3509: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + function a() { + console.log("PASS"); + } + try { + } catch (a) { + var a; + } + a(); + } + expect: { + try { + } catch (a) { + var a; + } + (function() { + console.log("PASS"); + })(); + } + expect_stdout: "PASS" +} -- cgit v1.2.3