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

View File

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

View File

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

View File

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

View File

@ -1 +1 @@
import * as foo from "foo";import {foo as bar, foo2 as bar2} from "foo";import {foo2} from "foo";export * from "foo";export {foo as bar} from "foo";export {foo} from "foo";
import * as foo from "foo";import {foo as bar,foo2 as bar2} from "foo";import {foo2} from "foo";export * from "foo";export {foo as bar} from "foo";export {foo} from "foo";