parenthesize a Call expression when its parent is New
authorMihai Bazon <mihai@bazon.net>
Wed, 7 Nov 2012 09:36:15 +0000 (11:36 +0200)
committerMihai Bazon <mihai@bazon.net>
Wed, 7 Nov 2012 09:36:15 +0000 (11:36 +0200)
fix #35

lib/output.js

index 46ed126..22ee31e 100644 (file)
@@ -468,6 +468,11 @@ function OutputStream(options) {
         }
     });
 
+    PARENS(AST_Call, function(output){
+        var p = output.parent();
+        return p instanceof AST_New && p.expression === this;
+    });
+
     PARENS(AST_New, function(output){
         var p = output.parent();
         // (new Date).getTime();