Use the general list handlers and the default separator.

This commit is contained in:
Logan Smyth 2016-04-25 19:59:14 -07:00
parent 315c075419
commit 3e1a661eb6
5 changed files with 13 additions and 15 deletions

View File

@ -1,5 +1,5 @@
export function ClassDeclaration(node: Object) { export function ClassDeclaration(node: Object) {
this.printJoin(node.decorators, node, { separator: "" }); this.printJoin(node.decorators, node);
this.push("class"); this.push("class");
if (node.id) { if (node.id) {
@ -17,7 +17,7 @@ export function ClassDeclaration(node: Object) {
if (node.implements) { if (node.implements) {
this.push(" implements "); this.push(" implements ");
this.printJoin(node.implements, node, { separator: ", " }); this.printList(node.implements, node);
} }
this.space(); this.space();
@ -43,7 +43,7 @@ export function ClassBody(node: Object) {
} }
export function ClassProperty(node: Object) { export function ClassProperty(node: Object) {
this.printJoin(node.decorators, node, { separator: "" }); this.printJoin(node.decorators, node);
if (node.static) this.push("static "); if (node.static) this.push("static ");
this.print(node.key, node); this.print(node.key, node);
@ -58,7 +58,7 @@ export function ClassProperty(node: Object) {
} }
export function ClassMethod(node: Object) { export function ClassMethod(node: Object) {
this.printJoin(node.decorators, node, { separator: "" }); this.printJoin(node.decorators, node);
if (node.static) { if (node.static) {
this.push("static "); this.push("static ");

View File

@ -112,11 +112,11 @@ export function _interfaceish(node: Object) {
this.print(node.typeParameters, node); this.print(node.typeParameters, node);
if (node.extends.length) { if (node.extends.length) {
this.push(" extends "); this.push(" extends ");
this.printJoin(node.extends, node, { separator: ", " }); this.printList(node.extends, node);
} }
if (node.mixins && node.mixins.length) { if (node.mixins && node.mixins.length) {
this.push(" mixins "); this.push(" mixins ");
this.printJoin(node.mixins, node, { separator: ", " }); this.printList(node.mixins, node);
} }
this.space(); this.space();
this.print(node.body, node); this.print(node.body, node);
@ -159,7 +159,7 @@ export function ThisTypeAnnotation() {
export function TupleTypeAnnotation(node: Object) { export function TupleTypeAnnotation(node: Object) {
this.push("["); this.push("[");
this.printJoin(node.types, node, { separator: ", " }); this.printList(node.types, node);
this.push("]"); this.push("]");
} }
@ -209,8 +209,7 @@ export function TypeParameter(node: Object) {
export function TypeParameterInstantiation(node: Object) { export function TypeParameterInstantiation(node: Object) {
this.push("<"); this.push("<");
this.printJoin(node.params, node, { this.printList(node.params, node, {
separator: ", ",
iterator: (node: Object) => { iterator: (node: Object) => {
this.print(node.typeAnnotation, node); this.print(node.typeAnnotation, node);
} }
@ -228,7 +227,6 @@ export function ObjectTypeAnnotation(node: Object) {
this.space(); this.space();
this.printJoin(props, node, { this.printJoin(props, node, {
separator: false,
indent: true, indent: true,
iterator: () => { iterator: () => {
if (props.length !== 1) { if (props.length !== 1) {

View File

@ -81,7 +81,7 @@ function ExportDeclaration(node: Object) {
this.push("{"); this.push("{");
if (specifiers.length) { if (specifiers.length) {
this.space(); this.space();
this.printJoin(specifiers, node, { separator: ", " }); this.printList(specifiers, node);
this.space(); this.space();
} }
this.push("}"); this.push("}");
@ -121,7 +121,7 @@ export function ImportDeclaration(node: Object) {
if (specifiers.length) { if (specifiers.length) {
this.push("{"); this.push("{");
this.space(); this.space();
this.printJoin(specifiers, node, { separator: ", " }); this.printList(specifiers, node);
this.space(); this.space();
this.push("}"); this.push("}");
} }

View File

@ -48,12 +48,12 @@ export function ObjectExpression(node: Object) {
export { ObjectExpression as ObjectPattern }; export { ObjectExpression as ObjectPattern };
export function ObjectMethod(node: Object) { export function ObjectMethod(node: Object) {
this.printJoin(node.decorators, node, { separator: "" }); this.printJoin(node.decorators, node);
this._method(node); this._method(node);
} }
export function ObjectProperty(node: Object) { export function ObjectProperty(node: Object) {
this.printJoin(node.decorators, node, { separator: "" }); this.printJoin(node.decorators, node);
if (node.computed) { if (node.computed) {
this.push("["); this.push("[");