Advanced way to specify if a function call might have side effects. #400

This commit is contained in:
thorn0 2014-01-18 15:16:43 +02:00
parent 75cdbf19aa
commit f6c5cbd4fa

View File

@ -856,6 +856,7 @@ merge(Compressor.prototype, {
def(AST_Call, function(compressor){ def(AST_Call, function(compressor){
var pure = compressor.option("pure_funcs"); var pure = compressor.option("pure_funcs");
if (!pure) return true; if (!pure) return true;
if (typeof pure == "function") return pure(this);
return pure.indexOf(this.expression.print_to_string()) < 0; return pure.indexOf(this.expression.print_to_string()) < 0;
}); });