Advanced way to specify if a function call might have side effects. #400
authorthorn0 <georgii.dolzhykov@stuzo.com>
Sat, 18 Jan 2014 13:16:43 +0000 (15:16 +0200)
committerRichard van Velzen <rvanvelzen@experty.com>
Wed, 29 Jul 2015 12:36:42 +0000 (14:36 +0200)
lib/compress.js

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