fix corner case in evaluate (#5363)

fixes #5362
This commit is contained in:
Alex Lam S.L
2022-02-20 13:38:04 +00:00
committed by GitHub
parent fbc5ecf75a
commit 212ce4608e
2 changed files with 41 additions and 2 deletions

View File

@@ -10799,8 +10799,11 @@ Compressor.prototype.compress = function(node) {
}
switch (op) {
case "+":
if (compressor.option("evaluate") && exp.is_number(compressor, true)) return exp;
break;
if (!compressor.option("evaluate")) break;
if (!exp.is_number(compressor, true)) break;
var parent = compressor.parent();
if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") break;
return exp;
case "-":
if (exp instanceof AST_Infinity) exp = exp.transform(compressor);
// avoids infinite recursion of numerals