@@ -7767,12 +7767,11 @@ merge(Compressor.prototype, {
|
|||||||
associative = compressor.option("unsafe_math");
|
associative = compressor.option("unsafe_math");
|
||||||
// +a - b => a - b
|
// +a - b => a - b
|
||||||
// a - +b => a - b
|
// a - +b => a - b
|
||||||
[ "left", "right" ].forEach(function(operand) {
|
if (self.operator != "+") [ "left", "right" ].forEach(function(operand) {
|
||||||
var node = self[operand];
|
var node = self[operand];
|
||||||
if (node instanceof AST_UnaryPrefix && node.operator == "+") {
|
if (node instanceof AST_UnaryPrefix && node.operator == "+") {
|
||||||
var exp = node.expression;
|
var exp = node.expression;
|
||||||
if (exp.is_boolean(compressor) || exp.is_number(compressor)
|
if (exp.is_boolean(compressor) || exp.is_number(compressor) || exp.is_string(compressor)) {
|
||||||
|| self.operator != "+" && exp.is_string(compressor)) {
|
|
||||||
self[operand] = exp;
|
self[operand] = exp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1322,3 +1322,16 @@ issue_4137: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "0"
|
expect_stdout: "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4142: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log("" + +(0 === console));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log("" + +(0 === console));
|
||||||
|
}
|
||||||
|
expect_stdout: "0"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user