parenthesize property access when it's the expression in New
authorMihai Bazon <mihai@bazon.net>
Wed, 7 Nov 2012 10:26:33 +0000 (12:26 +0200)
committerMihai Bazon <mihai@bazon.net>
Wed, 7 Nov 2012 10:26:33 +0000 (12:26 +0200)
refs #35

lib/output.js

index 2a17768..321c722 100644 (file)
@@ -468,6 +468,11 @@ function OutputStream(options) {
         }
     });
 
+    PARENS(AST_PropAccess, function(output){
+        var p = output.parent();
+        return p instanceof AST_New && p.expression === this;
+    });
+
     PARENS(AST_Call, function(output){
         var p = output.parent();
         return p instanceof AST_New && p.expression === this;