It's only valid if the node is the callee

This commit is contained in:
Amjad Masad 2015-11-24 19:24:05 -08:00
parent 486d781be3
commit c78c27a8d6

View File

@ -63,7 +63,7 @@ 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) && !t.isMemberExpression(parent)) return;
!t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent)) return;
this.push("(");
this.printList(node.arguments, node);