fix(class fields): handle untyped fields

This commit is contained in:
Victor Berchet 2014-11-19 19:43:36 +01:00
parent d6193e9073
commit f864aa1f8e
2 changed files with 11 additions and 3 deletions

View File

@ -51,6 +51,8 @@ class Foo {
class WithFields {
name: string;
static id: number;
untyped;
static staticUntyped;
}

View File

@ -15,7 +15,8 @@ import {
OPEN_SQUARE,
SEMI_COLON,
STAR,
STATIC
STATIC,
VAR
} from 'traceur/src/syntax/TokenType';
import {
@ -43,8 +44,13 @@ export class DartParseTreeWriter extends JavaScriptParseTreeWriter {
this.writeSpace_();
}
this.writeType_(tree.typeAnnotation);
if (tree.typeAnnotation === null) {
this.write_(VAR);
} else {
this.writeType_(tree.typeAnnotation);
}
this.writeSpace_();
this.visitAny(tree.name);
this.write_(SEMI_COLON);
}
@ -249,7 +255,7 @@ export class DartParseTreeWriter extends JavaScriptParseTreeWriter {
if (tree.typeAnnotation) {
this.writeType_(tree.typeAnnotation);
} else {
this.write_('var');
this.write_(VAR);
this.writeSpace_();
}
}