@@ -10799,8 +10799,11 @@ Compressor.prototype.compress = function(node) {
|
|||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case "+":
|
case "+":
|
||||||
if (compressor.option("evaluate") && exp.is_number(compressor, true)) return exp;
|
if (!compressor.option("evaluate")) break;
|
||||||
break;
|
if (!exp.is_number(compressor, true)) break;
|
||||||
|
var parent = compressor.parent();
|
||||||
|
if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") break;
|
||||||
|
return exp;
|
||||||
case "-":
|
case "-":
|
||||||
if (exp instanceof AST_Infinity) exp = exp.transform(compressor);
|
if (exp instanceof AST_Infinity) exp = exp.transform(compressor);
|
||||||
// avoids infinite recursion of numerals
|
// avoids infinite recursion of numerals
|
||||||
|
|||||||
@@ -3294,3 +3294,39 @@ issue_5356: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "NaN"
|
expect_stdout: "NaN"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5362_1: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = -console;
|
||||||
|
console.log(delete +a);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = -console;
|
||||||
|
console.log((+a, true));
|
||||||
|
}
|
||||||
|
expect_stdout: "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5362_2: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
side_effects: true,
|
||||||
|
toplevel: true,
|
||||||
|
unsafe: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = -console;
|
||||||
|
console.log(delete +a);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(true);
|
||||||
|
}
|
||||||
|
expect_stdout: "true"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user