diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js index 0a195940..13fc953d 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4172,10 +4172,18 @@ merge(Compressor.prototype, { var right = this.right.drop_side_effect_free(compressor, first_in_statement); if (!right) return this.left.drop_side_effect_free(compressor, first_in_statement); if (lazy_op[this.operator]) { - if (right === this.right) return this; - var node = this.clone(); - node.right = right.drop_side_effect_free(compressor); - return node; + var node; + if (right === this.right) { + node = this; + } else { + node = this.clone(); + node.right = right.drop_side_effect_free(compressor); + } + return (first_in_statement ? best_of_statement : best_of_expression)(node, make_node(AST_Binary, this, { + operator: node.operator == "&&" ? "||" : "&&", + left: node.left.negate(compressor, first_in_statement), + right: node.right + })); } else { var left = this.left.drop_side_effect_free(compressor, first_in_statement); if (!left) return right; |