make sure expression is AST_Binary

This commit is contained in:
alexlamsl 2017-01-19 17:28:47 +08:00
parent 5c7705fcad
commit 1aade735d0

View File

@ -2592,9 +2592,10 @@ merge(Compressor.prototype, {
} }
// x && (y && z) ==> x && y && z // x && (y && z) ==> x && y && z
// x || (y || z) ==> x || y || z // x || (y || z) ==> x || y || z
if (self.right instanceof AST_Binary if (self instanceof AST_Binary
&& self.right.operator == self.operator && self.right instanceof AST_Binary
&& (self.operator == "&&" || self.operator == "||")) && self.right.operator === self.operator
&& (self.operator === "&&" || self.operator === "||"))
{ {
self.left = make_node(AST_Binary, self.left, { self.left = make_node(AST_Binary, self.left, {
operator : self.operator, operator : self.operator,