move class property code gen to classes file

This commit is contained in:
Sebastian McKenzie
2015-03-29 19:31:02 +11:00
parent 2b0c07c2e7
commit 6a698f7ae4
2 changed files with 18 additions and 14 deletions

View File

@@ -1,8 +1,5 @@
export function ClassDeclaration(node, print) {
if (node.decorators && node.decorators.length) {
print.list(node.decorators);
}
print.list(node.decorators);
this.push("class");
if (node.id) {
@@ -44,10 +41,24 @@ export function ClassBody(node, print) {
}
}
export function MethodDefinition(node, print) {
if (node.decorators && node.decorators.length) {
print.list(node.decorators);
export function ClassProperty(node, print) {
print.list(node.decorators);
if (node.static) this.push("static ");
print(node.key);
print(node.typeAnnotation);
if (node.value) {
this.space();
this.push("=");
this.space();
print(node.value);
}
this.semicolon();
}
export function MethodDefinition(node, print) {
print.list(node.decorators);
if (node.static) {
this.push("static ");

View File

@@ -14,13 +14,6 @@ export function BooleanTypeAnnotation(node) {
this.push("bool");
}
export function ClassProperty(node, print) {
if (node.static) this.push("static ");
print(node.key);
print(node.typeAnnotation);
this.semicolon();
}
export function DeclareClass(node, print) {
this.push("declare class ");
this._interfaceish(node, print);