case "string":
return make_node(AST_String, orig, {
value: val
- }).optimize(compressor);
+ });
case "number":
if (isNaN(val)) {
return make_node(AST_NaN, orig);
});
}
- return make_node(AST_Number, orig, { value: val }).optimize(compressor);
+ return make_node(AST_Number, orig, { value: val });
case "boolean":
- return make_node(val ? AST_True : AST_False, orig).optimize(compressor);
+ return make_node(val ? AST_True : AST_False, orig).transform(compressor);
case "undefined":
- return make_node(AST_Undefined, orig).optimize(compressor);
+ return make_node(AST_Undefined, orig).transform(compressor);
default:
if (val === null) {
- return make_node(AST_Null, orig, { value: null }).optimize(compressor);
+ return make_node(AST_Null, orig, { value: null });
}
if (val instanceof RegExp) {
- return make_node(AST_RegExp, orig, { value: val }).optimize(compressor);
+ return make_node(AST_RegExp, orig, { value: val });
}
throw new Error(string_template("Can't handle constant of type: {type}", {
type: typeof val
});
OPT(AST_Call, function(self, compressor){
+ self.args = self.args.map(function(arg) {
+ return arg.evaluate(compressor)[0];
+ });
if (compressor.option("unsafe")) {
var exp = self.expression;
if (exp instanceof AST_SymbolRef && exp.undeclared()) {