Explicitly label standalone tokens and words.

This commit is contained in:
Logan Smyth
2016-04-30 13:45:29 -07:00
parent e702e67233
commit 4286cb4f2a
12 changed files with 245 additions and 220 deletions

View File

@@ -1,6 +1,6 @@
export function ClassDeclaration(node: Object) {
this.printJoin(node.decorators, node);
this.push("class");
this.word("class");
if (node.id) {
this.push(" ");
@@ -11,7 +11,7 @@ export function ClassDeclaration(node: Object) {
if (node.superClass) {
this.push(" ");
this.push("extends");
this.word("extends");
this.push(" ");
this.print(node.superClass, node);
this.print(node.superTypeParameters, node);
@@ -19,7 +19,7 @@ export function ClassDeclaration(node: Object) {
if (node.implements) {
this.push(" ");
this.push("implements");
this.word("implements");
this.push(" ");
this.printList(node.implements, node);
}
@@ -31,10 +31,10 @@ export function ClassDeclaration(node: Object) {
export { ClassDeclaration as ClassExpression };
export function ClassBody(node: Object) {
this.push("{");
this.token("{");
this.printInnerComments(node);
if (node.body.length === 0) {
this.push("}");
this.token("}");
} else {
this.newline();
@@ -50,14 +50,14 @@ export function ClassProperty(node: Object) {
this.printJoin(node.decorators, node);
if (node.static) {
this.push("static");
this.word("static");
this.push(" ");
}
this.print(node.key, node);
this.print(node.typeAnnotation, node);
if (node.value) {
this.space();
this.push("=");
this.token("=");
this.space();
this.print(node.value, node);
}
@@ -68,12 +68,12 @@ export function ClassMethod(node: Object) {
this.printJoin(node.decorators, node);
if (node.static) {
this.push("static");
this.word("static");
this.push(" ");
}
if (node.kind === "constructorCall") {
this.push("call");
this.word("call");
this.push(" ");
}