Handle member expressions

This commit is contained in:
Amjad Masad 2015-11-24 19:20:06 -08:00
parent f1f6c820fe
commit 486d781be3
3 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,8 @@ export function ConditionalExpression(node: Object) {
export function NewExpression(node: Object, parent: Object) {
this.push("new ");
this.print(node.callee, node);
if (node.arguments.length === 0 && this.format.compact && !t.isCallExpression(parent)) return;
if (node.arguments.length === 0 && this.format.compact &&
!t.isCallExpression(parent) && !t.isMemberExpression(parent)) return;
this.push("(");
this.printList(node.arguments, node);

View File

@ -1,2 +1,3 @@
new X();
new Y()();
new F().z;

View File

@ -1 +1 @@
new X;new Y()();
new X;new Y()();new F().z;