I'm extremely stupid and didn't commit as I go. To anyone reading this I'm extremely sorry. A lot of these changes are very broad and I plan on releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm afraid I couldn't wait. If you're ever in London I'll buy you a beer (or assorted beverage!) to make up for it, also I'll kiss your feet and give you a back massage, maybe.
75 lines
1.5 KiB
JavaScript
75 lines
1.5 KiB
JavaScript
/* @flow */
|
|
|
|
export function ClassDeclaration(node: Object) {
|
|
this.printJoin(node.decorators, node, { separator: "" });
|
|
this.push("class");
|
|
|
|
if (node.id) {
|
|
this.push(" ");
|
|
this.print(node.id, node);
|
|
}
|
|
|
|
this.print(node.typeParameters, node);
|
|
|
|
if (node.superClass) {
|
|
this.push(" extends ");
|
|
this.print(node.superClass, node);
|
|
this.print(node.superTypeParameters, node);
|
|
}
|
|
|
|
if (node.implements) {
|
|
this.push(" implements ");
|
|
this.printJoin(node.implements, node, { separator: ", " });
|
|
}
|
|
|
|
this.space();
|
|
this.print(node.body, node);
|
|
}
|
|
|
|
export { ClassDeclaration as ClassExpression };
|
|
|
|
export function ClassBody(node: Object) {
|
|
this.push("{");
|
|
this.printInnerComments(node);
|
|
if (node.body.length === 0) {
|
|
this.push("}");
|
|
} else {
|
|
this.newline();
|
|
|
|
this.indent();
|
|
this.printSequence(node.body, node);
|
|
this.dedent();
|
|
|
|
this.rightBrace();
|
|
}
|
|
}
|
|
|
|
export function ClassProperty(node: Object) {
|
|
this.printJoin(node.decorators, node, { separator: "" });
|
|
|
|
if (node.static) this.push("static ");
|
|
this.print(node.key, node);
|
|
this.print(node.typeAnnotation, node);
|
|
if (node.value) {
|
|
this.space();
|
|
this.push("=");
|
|
this.space();
|
|
this.print(node.value, node);
|
|
}
|
|
this.semicolon();
|
|
}
|
|
|
|
export function ClassMethod(node: Object) {
|
|
this.printJoin(node.decorators, node, { separator: "" });
|
|
|
|
if (node.static) {
|
|
this.push("static ");
|
|
}
|
|
|
|
if (node.kind === "constructorCall") {
|
|
this.push("call ");
|
|
}
|
|
|
|
this._method(node);
|
|
}
|