TypeScript/tests/baselines/reference/commentsFunction.js
Sheetal Nandi 6ab3adfd43 Modified the emitComment logic to handle emitting leading or trailing spaces depending on flags
Leading comments have trailing separator while trailing comments have leading space
This removes the extra trailing space in the trailing comments
2014-08-15 14:32:08 -07:00

89 lines
2.6 KiB
JavaScript

//// [commentsFunction.ts]
/** This comment should appear for foo*/
function foo() {
} /* trailing comment of function */
foo();
/** This is comment for function signature*/
function fooWithParameters(/** this is comment about a*/a: string,
/** this is comment for b*/
b: number) {
var d = a;
} // trailing comment of function
fooWithParameters("a", 10);
/** fooFunc
* comment
*/
var fooFunc = function FooFunctionValue(/** fooFunctionValue param */ b: string) {
return b;
}
/// lamdaFoo var comment
var lambdaFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => a + b;
var lambddaNoVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b;
lambdaFoo(10, 20);
lambddaNoVarComment(10, 20);
function blah(a: string /* multiline trailing comment
multiline */) {
}
function blah2(a: string /* single line multiple trailing comments */ /* second */) {
}
function blah3(a: string // trailing commen single line
) {
}
lambdaFoo = (a, b) => a * b; // This is trailing comment that will not get emitted since we are not emitting statement comments yet
//// [commentsFunction.js]
/** This comment should appear for foo*/
function foo() {
} /* trailing comment of function */
foo();
/** This is comment for function signature*/
function fooWithParameters(a,
/** this is comment for b*/
b) {
var d = a;
} // trailing comment of function
fooWithParameters("a", 10);
/** fooFunc
* comment
*/
var fooFunc = function FooFunctionValue(b) {
return b;
};
/// lamdaFoo var comment
var lambdaFoo = function (a, b) { return a + b; };
var lambddaNoVarComment = function (a, b) { return a * b; };
lambdaFoo(10, 20);
lambddaNoVarComment(10, 20);
function blah(a /* multiline trailing comment
multiline */) {
}
function blah2(a /* single line multiple trailing comments */ /* second */) {
}
function blah3(a // trailing commen single line
) {
}
lambdaFoo = function (a, b) { return a * b; };
//// [commentsFunction.d.ts]
/** This comment should appear for foo*/
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;
/** fooFunc
* comment
*/
declare var fooFunc: (b: string) => string;
declare var lambdaFoo: (a: number, b: number) => number;
declare var lambddaNoVarComment: (a: number, b: number) => number;
declare function blah(a: string): void;
declare function blah2(a: string): void;
declare function blah3(a: string): void;