diff --git a/lib/compress.js b/lib/compress.js index 3099fcde525..cb3cd3653b8 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -11809,7 +11809,7 @@ Compressor.prototype.compress = function(node) { left: self.left.right, right: self.right, }); - var after = before.optimize(compressor); + var after = before.transform(compressor); if (before !== after) { self.left = self.left.left; self.right = after; diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js index f42cce970e2..66de5c7d24c 100644 --- a/test/compress/conditionals.js +++ b/test/compress/conditionals.js @@ -3051,3 +3051,20 @@ issue_5694: { } expect_stdout: "NaN" } + +issue_5712: { + options = { + booleans: true, + conditionals: true, + evaluate: true, + } + input: { + var a = 0; + a || (++a).toString() && a && console.log("PASS"); + } + expect: { + var a = 0; + a || (++a).toString() && a && console.log("PASS"); + } + expect_stdout: "PASS" +}