109 lines
3.8 KiB
Text
109 lines
3.8 KiB
Text
=== tests/cases/compiler/commentsFunction.ts ===
|
|
|
|
/** This comment should appear for foo*/
|
|
function foo() {
|
|
>foo : Symbol(foo, Decl(commentsFunction.ts, 0, 0))
|
|
|
|
} /* trailing comment of function */
|
|
foo();
|
|
>foo : Symbol(foo, Decl(commentsFunction.ts, 0, 0))
|
|
|
|
/** This is comment for function signature*/
|
|
function fooWithParameters(/** this is comment about a*/a: string,
|
|
>fooWithParameters : Symbol(fooWithParameters, Decl(commentsFunction.ts, 4, 6))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 6, 27))
|
|
|
|
/** this is comment for b*/
|
|
b: number) {
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 6, 66))
|
|
|
|
var d = a;
|
|
>d : Symbol(d, Decl(commentsFunction.ts, 9, 7))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 6, 27))
|
|
|
|
} // trailing comment of function
|
|
fooWithParameters("a", 10);
|
|
>fooWithParameters : Symbol(fooWithParameters, Decl(commentsFunction.ts, 4, 6))
|
|
|
|
/** fooFunc
|
|
* comment
|
|
*/
|
|
var fooFunc = function FooFunctionValue(/** fooFunctionValue param */ b: string) {
|
|
>fooFunc : Symbol(fooFunc, Decl(commentsFunction.ts, 15, 3))
|
|
>FooFunctionValue : Symbol(FooFunctionValue, Decl(commentsFunction.ts, 15, 13))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 15, 40))
|
|
|
|
return b;
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 15, 40))
|
|
}
|
|
|
|
/// lamdaFoo var comment
|
|
var lambdaFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => a + b;
|
|
>lambdaFoo : Symbol(lambdaFoo, Decl(commentsFunction.ts, 20, 3))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 20, 46))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 20, 68))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 20, 46))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 20, 68))
|
|
|
|
var lambddaNoVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b;
|
|
>lambddaNoVarComment : Symbol(lambddaNoVarComment, Decl(commentsFunction.ts, 21, 3))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 21, 63))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 21, 85))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 21, 63))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 21, 85))
|
|
|
|
lambdaFoo(10, 20);
|
|
>lambdaFoo : Symbol(lambdaFoo, Decl(commentsFunction.ts, 20, 3))
|
|
|
|
lambddaNoVarComment(10, 20);
|
|
>lambddaNoVarComment : Symbol(lambddaNoVarComment, Decl(commentsFunction.ts, 21, 3))
|
|
|
|
function blah(a: string /* multiline trailing comment
|
|
>blah : Symbol(blah, Decl(commentsFunction.ts, 23, 28))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 25, 14))
|
|
|
|
multiline */) {
|
|
}
|
|
|
|
function blah2(a: string /* single line multiple trailing comments */ /* second */) {
|
|
>blah2 : Symbol(blah2, Decl(commentsFunction.ts, 27, 1))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 29, 15))
|
|
}
|
|
|
|
function blah3(a: string // trailing commen single line
|
|
>blah3 : Symbol(blah3, Decl(commentsFunction.ts, 30, 1))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 32, 15))
|
|
|
|
) {
|
|
}
|
|
|
|
lambdaFoo = (a, b) => a * b; // This is trailing comment
|
|
>lambdaFoo : Symbol(lambdaFoo, Decl(commentsFunction.ts, 20, 3))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 36, 13))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 36, 15))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 36, 13))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 36, 15))
|
|
|
|
/*leading comment*/() => 0; // Needs to be wrapped in parens to be a valid expression (not declaration)
|
|
/*leading comment*/(() => 0); //trailing comment
|
|
|
|
function blah4(/*1*/a: string/*2*/,/*3*/b: string/*4*/) {
|
|
>blah4 : Symbol(blah4, Decl(commentsFunction.ts, 39, 29))
|
|
>a : Symbol(a, Decl(commentsFunction.ts, 41, 15))
|
|
>b : Symbol(b, Decl(commentsFunction.ts, 41, 35))
|
|
}
|
|
|
|
function foo1() {
|
|
>foo1 : Symbol(foo1, Decl(commentsFunction.ts, 42, 1))
|
|
|
|
// should emit this
|
|
}
|
|
|
|
function foo2() {
|
|
>foo2 : Symbol(foo2, Decl(commentsFunction.ts, 47, 1))
|
|
|
|
/// This is some detached comment
|
|
|
|
// should emit this leading comment of } too
|
|
}
|
|
|