From e773f0392769794173358b362a645facb51b2ad2 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 3 Feb 2018 01:33:09 +0800 Subject: fix assignment logic in `reduce_vars` (#2872) fixes #2869 --- test/compress/reduce_vars.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 761af9e2..c0148204 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -5507,3 +5507,29 @@ issue_2860_2: { } expect_stdout: "1" } + +issue_2869: { + options = { + evaluate: true, + reduce_vars: true, + } + input: { + var c = "FAIL"; + (function f(a) { + var a; + if (!f) a = 0; + if (a) c = "PASS"; + })(1); + console.log(c); + } + expect: { + var c = "FAIL"; + (function f(a) { + var a; + if (!f) a = 0; + if (a) c = "PASS"; + })(1); + console.log(c); + } + expect_stdout: "PASS" +} -- cgit v1.2.3