diff options
-rw-r--r-- | lib/compress.js | 11 | ||||
-rw-r--r-- | test/compress/pure_getters.js | 32 |
2 files changed, 34 insertions, 9 deletions
diff --git a/lib/compress.js b/lib/compress.js index ac5cd235..4e3a8f82 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1693,15 +1693,8 @@ merge(Compressor.prototype, { return this.operator == "void"; }); def(AST_Binary, function(compressor) { - switch (this.operator) { - case "&&": - return this.left._dot_throw(compressor); - case "||": - return this.left._dot_throw(compressor) - && this.right._dot_throw(compressor); - default: - return false; - } + return (this.operator == "&&" || this.operator == "||") + && (this.left._dot_throw(compressor) || this.right._dot_throw(compressor)); }) def(AST_Assign, function(compressor) { return this.operator == "=" diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js index 4174bc1b..7185e0c6 100644 --- a/test/compress/pure_getters.js +++ b/test/compress/pure_getters.js @@ -611,3 +611,35 @@ issue_2313_6: { x(); } } + +issue_2678: { + options = { + pure_getters: "strict", + side_effects: true, + } + input: { + var a = 1, c = "FAIL"; + (function f() { + (a-- && f()).p; + return { + get p() { + c = "PASS"; + } + }; + })(); + console.log(c); + } + expect: { + var a = 1, c = "FAIL"; + (function f() { + (a-- && f()).p; + return { + get p() { + c = "PASS"; + } + }; + })(); + console.log(c); + } + expect_stdout: "PASS" +} |