babel-generator: Comment TypeScript-specific code (#6026)
This commit is contained in:
parent
c1d07fd6db
commit
e32042f353
@ -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();
|
||||
}
|
||||
|
||||
@ -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("?.");
|
||||
|
||||
@ -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("?");
|
||||
}
|
||||
|
||||
|
||||
@ -237,6 +237,7 @@ function constDeclarationIndent() {
|
||||
|
||||
export function VariableDeclaration(node: Object, parent: Object) {
|
||||
if (node.declare) {
|
||||
// TS
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user