Workaround for Safari bug
authorMihai Bazon <mihai@bazon.net>
Wed, 30 Oct 2013 11:59:59 +0000 (13:59 +0200)
committerMihai Bazon <mihai@bazon.net>
Wed, 30 Oct 2013 11:59:59 +0000 (13:59 +0200)
Close #313

lib/output.js

index 7f88d1f..37e30c0 100644 (file)
@@ -508,8 +508,17 @@ function OutputStream(options) {
     });
 
     PARENS(AST_Call, function(output){
-        var p = output.parent();
-        return p instanceof AST_New && p.expression === this;
+        var p = output.parent(), p1;
+        if (p instanceof AST_New && p.expression === this)
+            return true;
+
+        // workaround for Safari bug.
+        // https://bugs.webkit.org/show_bug.cgi?id=123506
+        return this.expression instanceof AST_Function
+            && p instanceof AST_PropAccess
+            && p.expression === this
+            && (p1 = output.parent(1)) instanceof AST_Assign
+            && p1.left === p;
     });
 
     PARENS(AST_New, function(output){