@@ -11634,10 +11634,14 @@ Compressor.prototype.compress = function(node) {
11634
11634
});
11635
11635
self.right = rhs.right;
11636
11636
if (compressor) {
11637
- self.left = self.left.transform(compressor);
11638
- } else if (self.operator == rhs.left.operator) {
11639
- swap_chain(self.left);
11637
+ var left = self.left.transform(compressor);
11638
+ if (left !== self.left) {
11639
+ self = self.clone();
11640
+ self.left = left;
11641
+ }
11642
+ return self;
11640
11643
}
11644
+ if (self.operator == rhs.left.operator) swap_chain(self.left);
11641
11645
}
11642
11646
11643
11647
OPT(AST_Binary, function(self, compressor) {
@@ -11825,7 +11829,7 @@ Compressor.prototype.compress = function(node) {
11825
11829
// x && (y && z) ---> x && y && z
11826
11830
// w || (x, y || z) ---> w || (x, y) || z
11827
11831
var rhs = self.right.tail_node();
11828
- if (rhs instanceof AST_Binary && self.operator == rhs.operator) swap_chain(self, compressor);
11832
+ if (rhs instanceof AST_Binary && self.operator == rhs.operator) self = swap_chain(self, compressor);
11829
11833
}
11830
11834
if (compressor.option("strings") && self.operator == "+") {
11831
11835
// "foo" + 42 + "" ---> "foo" + 42
@@ -11858,7 +11862,7 @@ Compressor.prototype.compress = function(node) {
11858
11862
&& (self.left.is_string(compressor) && rhs.is_string(compressor)
11859
11863
|| rhs.left.is_string(compressor)
11860
11864
&& (self.left.is_constant() || !rhs.right.has_side_effects(compressor)))) {
11861
- swap_chain(self, compressor);
11865
+ self = swap_chain(self, compressor);
11862
11866
}
11863
11867
}
11864
11868
if (compressor.option("evaluate")) {
0 commit comments