Skip to content

Commit

Permalink
Don't drop parens in a * (b * c). Close #744
Browse files Browse the repository at this point in the history
  • Loading branch information
mishoo committed Jun 30, 2015
1 parent 5bf617e commit 85a5fc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -2230,10 +2230,11 @@ merge(Compressor.prototype, {
}
}
}
// x * (y * z) ==> x * y * z
// x && (y && z) ==> x && y && z
// x || (y || z) ==> x || y || z
if (self.right instanceof AST_Binary
&& self.right.operator == self.operator
&& (self.operator == "*" || self.operator == "&&" || self.operator == "||"))
&& (self.operator == "&&" || self.operator == "||"))
{
self.left = make_node(AST_Binary, self.left, {
operator : self.operator,
Expand Down

0 comments on commit 85a5fc0

Please sign in to comment.