Fix the indent for the parameter and typeparameter emit in .d.ts file

This commit is contained in:
Sheetal Nandi 2014-08-14 09:38:22 -07:00
parent b8bbb0d547
commit c949543f49
7 changed files with 23 additions and 19 deletions

View File

@ -2260,7 +2260,9 @@ module ts {
};
}
increaseIndent();
emitJsDocComments(node);
decreaseIndent();
emitSourceTextOfNode(node.name);
// If there is constraint present and this is not a type parameter of the private method emit the constraint
if (node.constraint && (node.parent.kind !== SyntaxKind.Method || !(node.parent.flags & NodeFlags.Private))) {
@ -2647,6 +2649,7 @@ module ts {
}
function emitParameterDeclaration(node: ParameterDeclaration) {
increaseIndent();
emitJsDocComments(node);
if (node.flags & NodeFlags.Rest) {
write("...");
@ -2655,6 +2658,7 @@ module ts {
if (node.initializer || (node.flags & NodeFlags.QuestionMark)) {
write("?");
}
decreaseIndent();
if (!(node.parent.flags & NodeFlags.Private)) {
write(": ");

View File

@ -53,7 +53,7 @@ lambddaNoVarComment(10, 20);
declare function foo(): void;
/** This is comment for function signature*/
declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
/** fooFunc
* comment
*/

View File

@ -77,7 +77,7 @@ export interface ICallSignature {
export interface ICallSignatureWithParameters {
/** This is comment for function signature*/
(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
}
export interface ICallSignatureWithRestParameters {
(a: string, ...rests: string[]): string;
@ -101,7 +101,7 @@ interface IGlobalCallSignature {
interface IGlobalCallSignatureWithParameters {
/** This is comment for function signature*/
(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
}
interface IGlobalCallSignatureWithRestParameters {
(a: string, ...rests: string[]): string;

View File

@ -77,7 +77,7 @@ export interface IConstructSignature {
export interface IConstructSignatureWithParameters {
/** This is comment for function signature*/
new (/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): any;
b: number): any;
}
export interface IConstructSignatureWithRestParameters {
new (a: string, ...rests: string[]): string;
@ -101,7 +101,7 @@ interface IGlobalConstructSignature {
interface IGlobalConstructSignatureWithParameters {
/** This is comment for function signature*/
new (/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): any;
b: number): any;
}
interface IGlobalConstructSignatureWithRestParameters {
new (a: string, ...rests: string[]): string;

View File

@ -225,7 +225,7 @@ export declare class SimpleConstructor {
export declare class ConstructorWithParameters {
/** This is comment for function signature*/
constructor(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number);
b: number);
}
export declare class ConstructorWithRestParamters {
constructor(a: string, ...rests: string[]);
@ -258,7 +258,7 @@ declare class GlobalSimpleConstructor {
declare class GlobalConstructorWithParameters {
/** This is comment for function signature*/
constructor(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number);
b: number);
}
declare class GlobalConstructorWithRestParamters {
constructor(a: string, ...rests: string[]);

View File

@ -126,7 +126,7 @@ function globalfooWithOverloads(a) {
export declare function foo(): void;
/** This is comment for function signature*/
export declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
export declare function fooWithRestParameters(a: string, ...rests: string[]): string;
export declare function fooWithOverloads(a: string): string;
export declare function fooWithOverloads(a: number): number;
@ -135,7 +135,7 @@ export declare function fooWithOverloads(a: number): number;
declare function globalfoo(): void;
/** This is comment for function signature*/
declare function globalfooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
declare function globalfooWithRestParameters(a: string, ...rests: string[]): string;
declare function globalfooWithOverloads(a: string): string;
declare function globalfooWithOverloads(a: number): number;

View File

@ -355,7 +355,7 @@ export declare class c1 {
foo(): void;
/** This is comment for function signature*/
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
fooWithRestParameters(a: string, ...rests: string[]): string;
fooWithOverloads(a: string): string;
fooWithOverloads(a: number): number;
@ -363,7 +363,7 @@ export declare class c1 {
private privateFoo();
/** This is comment for function signature*/
private privateFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
b);
b);
private privateFooWithRestParameters(a, ...rests);
private privateFooWithOverloads(a);
private privateFooWithOverloads(a);
@ -371,7 +371,7 @@ export declare class c1 {
static staticFoo(): void;
/** This is comment for function signature*/
static staticFooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
static staticFooWithRestParameters(a: string, ...rests: string[]): string;
static staticFooWithOverloads(a: string): string;
static staticFooWithOverloads(a: number): number;
@ -379,7 +379,7 @@ export declare class c1 {
private static privateStaticFoo();
/** This is comment for function signature*/
private static privateStaticFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
b);
b);
private static privateStaticFooWithRestParameters(a, ...rests);
private static privateStaticFooWithOverloads(a);
private static privateStaticFooWithOverloads(a);
@ -389,7 +389,7 @@ export interface I1 {
foo(): string;
/** This is comment for function signature*/
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
fooWithRestParameters(a: string, ...rests: string[]): string;
fooWithOverloads(a: string): string;
fooWithOverloads(a: number): number;
@ -400,7 +400,7 @@ declare class c2 {
foo(): void;
/** This is comment for function signature*/
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
fooWithRestParameters(a: string, ...rests: string[]): string;
fooWithOverloads(a: string): string;
fooWithOverloads(a: number): number;
@ -408,7 +408,7 @@ declare class c2 {
private privateFoo();
/** This is comment for function signature*/
private privateFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
b);
b);
private privateFooWithRestParameters(a, ...rests);
private privateFooWithOverloads(a);
private privateFooWithOverloads(a);
@ -416,7 +416,7 @@ declare class c2 {
static staticFoo(): void;
/** This is comment for function signature*/
static staticFooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
static staticFooWithRestParameters(a: string, ...rests: string[]): string;
static staticFooWithOverloads(a: string): string;
static staticFooWithOverloads(a: number): number;
@ -424,7 +424,7 @@ declare class c2 {
private static privateStaticFoo();
/** This is comment for function signature*/
private static privateStaticFooWithParameters(/** this is comment about a*/ a, /** this is comment for b*/
b);
b);
private static privateStaticFooWithRestParameters(a, ...rests);
private static privateStaticFooWithOverloads(a);
private static privateStaticFooWithOverloads(a);
@ -434,7 +434,7 @@ interface I2 {
foo(): string;
/** This is comment for function signature*/
fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/
b: number): void;
b: number): void;
fooWithRestParameters(a: string, ...rests: string[]): string;
fooWithOverloads(a: string): string;
fooWithOverloads(a: number): number;