account for parent NewExpression with arguments
This commit is contained in:
parent
8a1ad5350c
commit
21f76655ad
@ -63,7 +63,9 @@ 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, { callee: node }) && !t.isMemberExpression(parent)) return;
|
||||
!t.isCallExpression(parent, { callee: node }) &&
|
||||
!t.isMemberExpression(parent) &&
|
||||
!(t.isNewExpression(parent) && parent.arguments.length > 0)) return;
|
||||
|
||||
this.push("(");
|
||||
this.printList(node.arguments, node);
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
new X();
|
||||
new Y()();
|
||||
new F().z;
|
||||
|
||||
new new x()();
|
||||
new new x()(a);
|
||||
new new x(a)();
|
||||
new new x(a)(a);
|
||||
|
||||
@ -1 +1 @@
|
||||
new X;new Y()();new F().z;
|
||||
new X;new Y()();new F().z;new new x;new new x()(a);new new x(a);new new x(a)(a);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user