From 5045e140b18485132b533c4ee52a18f97f3bf6f9 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 9 Nov 2019 00:53:15 +0800 Subject: fix corner case in `conditionals` (#3577) fixes #3576 --- test/compress/conditionals.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js index 27536b9f..3e7a0927 100644 --- a/test/compress/conditionals.js +++ b/test/compress/conditionals.js @@ -1489,3 +1489,29 @@ angularjs_chain: { } } } + +issue_3576: { + options = { + conditionals: true, + evaluate: true, + pure_getters: "strict", + reduce_vars: true, + } + input: { + var c = "FAIL"; + (function(a) { + (a = -1) ? (a && (a.a = 0)) : (a && (a.a = 0)); + a && a[c = "PASS"]++; + })(); + console.log(c); + } + expect: { + var c = "FAIL"; + (function(a) { + a = -1, a, a.a = 0; + a, a[c = "PASS"]++; + })(); + console.log(c); + } + expect_stdout: "PASS" +} -- cgit v1.2.3