@@ -4788,6 +4788,34 @@ merge(Compressor.prototype, {
|
||||
return make_node(self.operator[0] == "=" ? AST_True : AST_False, self);
|
||||
}
|
||||
break;
|
||||
case "&&":
|
||||
case "||":
|
||||
var lhs = self.left;
|
||||
if (lhs.operator == self.operator) {
|
||||
lhs = lhs.right;
|
||||
}
|
||||
if (lhs instanceof AST_Binary
|
||||
&& lhs.operator == (self.operator == "&&" ? "!==" : "===")
|
||||
&& self.right instanceof AST_Binary
|
||||
&& lhs.operator == self.right.operator
|
||||
&& (is_undefined(lhs.left, compressor) && self.right.left instanceof AST_Null
|
||||
|| lhs.left instanceof AST_Null && is_undefined(self.right.left, compressor))
|
||||
&& lhs.right.equivalent_to(self.right.right)) {
|
||||
var combined = make_node(AST_Binary, self, {
|
||||
operator: lhs.operator.slice(0, -1),
|
||||
left: make_node(AST_Null, self),
|
||||
right: lhs.right
|
||||
});
|
||||
if (lhs !== self.left) {
|
||||
combined = make_node(AST_Binary, self, {
|
||||
operator: self.operator,
|
||||
left: self.left.left,
|
||||
right: combined
|
||||
});
|
||||
}
|
||||
return combined;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (self.operator == "+" && compressor.in_boolean_context()) {
|
||||
var ll = self.left.evaluate(compressor);
|
||||
|
||||
Reference in New Issue
Block a user