remove redundant transform (#4123)
This commit is contained in:
@@ -7660,29 +7660,6 @@ merge(Compressor.prototype, {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// (x + "foo") + ("bar" + y) => (x + "foobar") + y
|
|
||||||
if (self.left instanceof AST_Binary
|
|
||||||
&& self.left.operator == "+"
|
|
||||||
&& self.left.is_string(compressor)
|
|
||||||
&& self.left.right instanceof AST_Constant
|
|
||||||
&& self.right instanceof AST_Binary
|
|
||||||
&& self.right.operator == "+"
|
|
||||||
&& self.right.left instanceof AST_Constant
|
|
||||||
&& self.right.is_string(compressor)) {
|
|
||||||
self = make_node(AST_Binary, self, {
|
|
||||||
operator: "+",
|
|
||||||
left: make_node(AST_Binary, self.left, {
|
|
||||||
operator: "+",
|
|
||||||
left: self.left.left,
|
|
||||||
right: make_node(AST_String, self.left.right, {
|
|
||||||
value: "" + self.left.right.value + self.right.left.value,
|
|
||||||
start: self.left.right.start,
|
|
||||||
end: self.right.left.end
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
right: self.right.right
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// a + -b => a - b
|
// a + -b => a - b
|
||||||
if (self.right instanceof AST_UnaryPrefix
|
if (self.right instanceof AST_UnaryPrefix
|
||||||
&& self.right.operator == "-"
|
&& self.right.operator == "-"
|
||||||
|
|||||||
Reference in New Issue
Block a user