Handle new X()()

This commit is contained in:
Amjad Masad 2015-11-24 19:12:24 -08:00
parent d32fae6fcd
commit f1f6c820fe
3 changed files with 4 additions and 3 deletions

View File

@ -59,10 +59,10 @@ export function ConditionalExpression(node: Object) {
this.print(node.alternate, node);
}
export function NewExpression(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) return;
if (node.arguments.length === 0 && this.format.compact && !t.isCallExpression(parent)) return;
this.push("(");
this.printList(node.arguments, node);

View File

@ -1 +1,2 @@
new X();
new Y()();

View File

@ -1 +1 @@
new X;
new X;new Y()();