From 7bc7704edfe0a8af39924889e58b3d67f135b230 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Thu, 10 May 2018 18:45:20 +0800 Subject: fix corner case in `reduce_vars` (#3129) --- test/compress/reduce_vars.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/compress') diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index bc5fcf1b..ac55f81d 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -6059,6 +6059,38 @@ conditional_nested_2: { expect_stdout: "1" } +conditional_nested_3: { + options = { + evaluate: true, + reduce_vars: true, + } + input: { + var n = 2, c = 0; + (function f(a) { + 0 < n-- && g(a = 1); + function g() { + a && c++; + } + g(); + 0 < n-- && f(); + })(); + console.log(c); + } + expect: { + var n = 2, c = 0; + (function f(a) { + 0 < n-- && g(a = 1); + function g() { + a && c++; + } + g(); + 0 < n-- && f(); + })(); + console.log(c); + } + expect_stdout: "2" +} + issue_2436: { options = { evaluate: true, -- cgit v1.2.3