babel-generator: Comment TypeScript-specific code (#6026)

This commit is contained in:
Andy 2017-07-28 15:03:38 -07:00 committed by Henry Zhu
parent c1d07fd6db
commit e32042f353
4 changed files with 14 additions and 4 deletions

View File

@ -9,11 +9,13 @@ export function ClassDeclaration(node: Object, parent: Object) {
}
if (node.declare) {
// TS
this.word("declare");
this.space();
}
if (node.abstract) {
// TS
this.word("abstract");
this.space();
}
@ -70,6 +72,7 @@ export function ClassProperty(node: Object) {
this.printJoin(node.decorators, node);
if (node.accessibility) {
// TS
this.word(node.accessibility);
this.space();
}
@ -78,10 +81,12 @@ export function ClassProperty(node: Object) {
this.space();
}
if (node.abstract) {
// TS
this.word("abstract");
this.space();
}
if (node.readonly) {
// TS
this.word("readonly");
this.space();
}
@ -95,6 +100,7 @@ export function ClassProperty(node: Object) {
}
if (node.optional) {
// TS
this.token("?");
}
@ -118,11 +124,13 @@ export function _classMethodHead(node) {
this.printJoin(node.decorators, node);
if (node.accessibility) {
// TS
this.word(node.accessibility);
this.space();
}
if (node.abstract) {
// TS
this.word("abstract");
this.space();
}

View File

@ -65,7 +65,7 @@ export function NewExpression(node: Object, parent: Object) {
return;
}
this.print(node.typeParameters, node);
this.print(node.typeParameters, node); // TS
if (node.optional) {
this.token("?.");
@ -96,7 +96,7 @@ export function Decorator(node: Object) {
export function CallExpression(node: Object) {
this.print(node.callee, node);
this.print(node.typeParameters, node);
this.print(node.typeParameters, node); // TS
if (node.optional) {
this.token("?.");

View File

@ -23,8 +23,8 @@ export function _parameters(parameters, parent) {
export function _param(parameter, parent) {
this.printJoin(parameter.decorators, parameter);
this.print(parameter, parent);
if (parameter.optional) this.token("?");
this.print(parameter.typeAnnotation, parameter);
if (parameter.optional) this.token("?"); // TS / flow
this.print(parameter.typeAnnotation, parameter); // TS / flow
}
export function _methodHead(node: Object) {
@ -56,6 +56,7 @@ export function _methodHead(node: Object) {
}
if (node.optional) {
// TS
this.token("?");
}

View File

@ -237,6 +237,7 @@ function constDeclarationIndent() {
export function VariableDeclaration(node: Object, parent: Object) {
if (node.declare) {
// TS
this.word("declare");
this.space();
}