remove dead code (#2405)
This commit is contained in:
@@ -1647,35 +1647,6 @@ merge(Compressor.prototype, {
|
|||||||
&& unaryPrefix(this.operator);
|
&& unaryPrefix(this.operator);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Obtain the constant value of an expression already known to be constant.
|
|
||||||
// Result only valid iff this.is_constant() is true.
|
|
||||||
AST_Node.DEFMETHOD("constant_value", function(compressor){
|
|
||||||
// Accomodate when option evaluate=false.
|
|
||||||
if (this instanceof AST_Constant && !(this instanceof AST_RegExp)) {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
// Accomodate the common constant expressions !0 and -1 when option evaluate=false.
|
|
||||||
if (this instanceof AST_UnaryPrefix
|
|
||||||
&& this.expression instanceof AST_Constant) switch (this.operator) {
|
|
||||||
case "!":
|
|
||||||
return !this.expression.value;
|
|
||||||
case "~":
|
|
||||||
return ~this.expression.value;
|
|
||||||
case "-":
|
|
||||||
return -this.expression.value;
|
|
||||||
case "+":
|
|
||||||
return +this.expression.value;
|
|
||||||
default:
|
|
||||||
throw new Error(string_template("Cannot evaluate unary expression {value}", {
|
|
||||||
value: this.print_to_string()
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
var result = this.evaluate(compressor);
|
|
||||||
if (result !== this) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
throw new Error(string_template("Cannot evaluate constant [{file}:{line},{col}]", this.start));
|
|
||||||
});
|
|
||||||
def(AST_Statement, function(){
|
def(AST_Statement, function(){
|
||||||
throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]", this.start));
|
throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]", this.start));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user