TypeScript/tests/baselines/reference/commentsFunction.types

134 lines
3.2 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/commentsFunction.ts ===
/** This comment should appear for foo*/
function foo() {
>foo : () => void
2014-08-28 01:58:31 +02:00
} /* trailing comment of function */
2014-08-15 23:33:16 +02:00
foo();
>foo() : void
>foo : () => void
2014-08-15 23:33:16 +02:00
/** This is comment for function signature*/
function fooWithParameters(/** this is comment about a*/a: string,
>fooWithParameters : (a: string, b: number) => void
>a : string
2014-08-15 23:33:16 +02:00
/** this is comment for b*/
b: number) {
>b : number
2014-08-15 23:33:16 +02:00
var d = a;
>d : string
>a : string
2014-08-28 01:58:31 +02:00
} // trailing comment of function
2014-08-15 23:33:16 +02:00
fooWithParameters("a", 10);
>fooWithParameters("a", 10) : void
>fooWithParameters : (a: string, b: number) => void
2015-04-13 21:36:11 +02:00
>"a" : string
>10 : number
2014-08-15 23:33:16 +02:00
/** fooFunc
* comment
*/
var fooFunc = function FooFunctionValue(/** fooFunctionValue param */ b: string) {
>fooFunc : (b: string) => string
2014-08-22 03:39:46 +02:00
>function FooFunctionValue(/** fooFunctionValue param */ b: string) { return b;} : (b: string) => string
>FooFunctionValue : (b: string) => string
>b : string
2014-08-15 23:33:16 +02:00
return b;
>b : string
2014-08-15 23:33:16 +02:00
}
/// lamdaFoo var comment
var lambdaFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => a + b;
>lambdaFoo : (a: number, b: number) => number
2014-08-15 23:33:16 +02:00
>(/**param a*/a: number, /**param b*/b: number) => a + b : (a: number, b: number) => number
>a : number
>b : number
2014-08-15 23:33:16 +02:00
>a + b : number
>a : number
>b : number
2014-08-15 23:33:16 +02:00
var lambddaNoVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b;
>lambddaNoVarComment : (a: number, b: number) => number
2014-08-15 23:33:16 +02:00
>(/**param a*/a: number, /**param b*/b: number) => a * b : (a: number, b: number) => number
>a : number
>b : number
2014-08-15 23:33:16 +02:00
>a * b : number
>a : number
>b : number
2014-08-15 23:33:16 +02:00
lambdaFoo(10, 20);
>lambdaFoo(10, 20) : number
>lambdaFoo : (a: number, b: number) => number
2015-04-13 21:36:11 +02:00
>10 : number
>20 : number
2014-08-15 23:33:16 +02:00
lambddaNoVarComment(10, 20);
>lambddaNoVarComment(10, 20) : number
>lambddaNoVarComment : (a: number, b: number) => number
2015-04-13 21:36:11 +02:00
>10 : number
>20 : number
2014-08-15 23:33:16 +02:00
2014-08-28 01:58:31 +02:00
function blah(a: string /* multiline trailing comment
>blah : (a: string) => void
>a : string
2014-08-28 01:58:31 +02:00
multiline */) {
}
function blah2(a: string /* single line multiple trailing comments */ /* second */) {
>blah2 : (a: string) => void
>a : string
2014-08-28 01:58:31 +02:00
}
function blah3(a: string // trailing commen single line
>blah3 : (a: string) => void
>a : string
2014-08-28 01:58:31 +02:00
) {
}
lambdaFoo = (a, b) => a * b; // This is trailing comment
>lambdaFoo = (a, b) => a * b : (a: number, b: number) => number
>lambdaFoo : (a: number, b: number) => number
2014-08-28 01:58:31 +02:00
>(a, b) => a * b : (a: number, b: number) => number
>a : number
>b : number
2014-08-28 01:58:31 +02:00
>a * b : number
>a : number
>b : number
2014-08-28 01:58:31 +02:00
/*leading comment*/() => 0; // Needs to be wrapped in parens to be a valid expression (not declaration)
>() => 0 : () => number
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-28 01:58:31 +02:00
/*leading comment*/(() => 0); //trailing comment
>(() => 0) : () => number
>() => 0 : () => number
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-28 01:58:31 +02:00
function blah4(/*1*/a: string/*2*/,/*3*/b: string/*4*/) {
>blah4 : (a: string, b: string) => void
>a : string
>b : string
2014-08-28 01:58:31 +02:00
}
function foo1() {
>foo1 : () => void
2014-08-28 01:58:31 +02:00
// should emit this
}
function foo2() {
>foo2 : () => void
2014-08-28 01:58:31 +02:00
/// This is some detached comment
// should emit this leading comment of } too
}