168 lines
7.8 KiB
Text
168 lines
7.8 KiB
Text
=== tests/cases/compiler/funcdecl.ts ===
|
|
function simpleFunc() {
|
|
>simpleFunc : () => string, Symbol(simpleFunc, Decl(funcdecl.ts, 0, 0))
|
|
|
|
return "this is my simple func";
|
|
>"this is my simple func" : string
|
|
}
|
|
var simpleFuncVar = simpleFunc;
|
|
>simpleFuncVar : () => string, Symbol(simpleFuncVar, Decl(funcdecl.ts, 3, 3))
|
|
>simpleFunc : () => string, Symbol(simpleFunc, Decl(funcdecl.ts, 0, 0))
|
|
|
|
function anotherFuncNoReturn() {
|
|
>anotherFuncNoReturn : () => void, Symbol(anotherFuncNoReturn, Decl(funcdecl.ts, 3, 31))
|
|
}
|
|
var anotherFuncNoReturnVar = anotherFuncNoReturn;
|
|
>anotherFuncNoReturnVar : () => void, Symbol(anotherFuncNoReturnVar, Decl(funcdecl.ts, 7, 3))
|
|
>anotherFuncNoReturn : () => void, Symbol(anotherFuncNoReturn, Decl(funcdecl.ts, 3, 31))
|
|
|
|
function withReturn() : string{
|
|
>withReturn : () => string, Symbol(withReturn, Decl(funcdecl.ts, 7, 49))
|
|
|
|
return "Hello";
|
|
>"Hello" : string
|
|
}
|
|
var withReturnVar = withReturn;
|
|
>withReturnVar : () => string, Symbol(withReturnVar, Decl(funcdecl.ts, 12, 3))
|
|
>withReturn : () => string, Symbol(withReturn, Decl(funcdecl.ts, 7, 49))
|
|
|
|
function withParams(a : string) : string{
|
|
>withParams : (a: string) => string, Symbol(withParams, Decl(funcdecl.ts, 12, 31))
|
|
>a : string, Symbol(a, Decl(funcdecl.ts, 14, 20))
|
|
|
|
return a;
|
|
>a : string, Symbol(a, Decl(funcdecl.ts, 14, 20))
|
|
}
|
|
var withparamsVar = withParams;
|
|
>withparamsVar : (a: string) => string, Symbol(withparamsVar, Decl(funcdecl.ts, 17, 3))
|
|
>withParams : (a: string) => string, Symbol(withParams, Decl(funcdecl.ts, 12, 31))
|
|
|
|
function withMultiParams(a : number, b, c: Object) {
|
|
>withMultiParams : (a: number, b: any, c: Object) => number, Symbol(withMultiParams, Decl(funcdecl.ts, 17, 31))
|
|
>a : number, Symbol(a, Decl(funcdecl.ts, 19, 25))
|
|
>b : any, Symbol(b, Decl(funcdecl.ts, 19, 36))
|
|
>c : Object, Symbol(c, Decl(funcdecl.ts, 19, 39))
|
|
>Object : Object, Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
|
|
return a;
|
|
>a : number, Symbol(a, Decl(funcdecl.ts, 19, 25))
|
|
}
|
|
var withMultiParamsVar = withMultiParams;
|
|
>withMultiParamsVar : (a: number, b: any, c: Object) => number, Symbol(withMultiParamsVar, Decl(funcdecl.ts, 22, 3))
|
|
>withMultiParams : (a: number, b: any, c: Object) => number, Symbol(withMultiParams, Decl(funcdecl.ts, 17, 31))
|
|
|
|
function withOptionalParams(a?: string) {
|
|
>withOptionalParams : (a?: string) => void, Symbol(withOptionalParams, Decl(funcdecl.ts, 22, 41))
|
|
>a : string, Symbol(a, Decl(funcdecl.ts, 24, 28))
|
|
}
|
|
var withOptionalParamsVar = withOptionalParams;
|
|
>withOptionalParamsVar : (a?: string) => void, Symbol(withOptionalParamsVar, Decl(funcdecl.ts, 26, 3))
|
|
>withOptionalParams : (a?: string) => void, Symbol(withOptionalParams, Decl(funcdecl.ts, 22, 41))
|
|
|
|
function withInitializedParams(a: string, b0, b = 30, c = "string value") {
|
|
>withInitializedParams : (a: string, b0: any, b?: number, c?: string) => void, Symbol(withInitializedParams, Decl(funcdecl.ts, 26, 47))
|
|
>a : string, Symbol(a, Decl(funcdecl.ts, 28, 31))
|
|
>b0 : any, Symbol(b0, Decl(funcdecl.ts, 28, 41))
|
|
>b : number, Symbol(b, Decl(funcdecl.ts, 28, 45))
|
|
>30 : number
|
|
>c : string, Symbol(c, Decl(funcdecl.ts, 28, 53))
|
|
>"string value" : string
|
|
}
|
|
var withInitializedParamsVar = withInitializedParams;
|
|
>withInitializedParamsVar : (a: string, b0: any, b?: number, c?: string) => void, Symbol(withInitializedParamsVar, Decl(funcdecl.ts, 30, 3))
|
|
>withInitializedParams : (a: string, b0: any, b?: number, c?: string) => void, Symbol(withInitializedParams, Decl(funcdecl.ts, 26, 47))
|
|
|
|
function withOptionalInitializedParams(a: string, c: string = "hello string") {
|
|
>withOptionalInitializedParams : (a: string, c?: string) => void, Symbol(withOptionalInitializedParams, Decl(funcdecl.ts, 30, 53))
|
|
>a : string, Symbol(a, Decl(funcdecl.ts, 32, 39))
|
|
>c : string, Symbol(c, Decl(funcdecl.ts, 32, 49))
|
|
>"hello string" : string
|
|
}
|
|
var withOptionalInitializedParamsVar = withOptionalInitializedParams;
|
|
>withOptionalInitializedParamsVar : (a: string, c?: string) => void, Symbol(withOptionalInitializedParamsVar, Decl(funcdecl.ts, 34, 3))
|
|
>withOptionalInitializedParams : (a: string, c?: string) => void, Symbol(withOptionalInitializedParams, Decl(funcdecl.ts, 30, 53))
|
|
|
|
function withRestParams(a: string, ... myRestParameter : number[]) {
|
|
>withRestParams : (a: string, ...myRestParameter: number[]) => number[], Symbol(withRestParams, Decl(funcdecl.ts, 34, 69))
|
|
>a : string, Symbol(a, Decl(funcdecl.ts, 36, 24))
|
|
>myRestParameter : number[], Symbol(myRestParameter, Decl(funcdecl.ts, 36, 34))
|
|
|
|
return myRestParameter;
|
|
>myRestParameter : number[], Symbol(myRestParameter, Decl(funcdecl.ts, 36, 34))
|
|
}
|
|
var withRestParamsVar = withRestParams;
|
|
>withRestParamsVar : (a: string, ...myRestParameter: number[]) => number[], Symbol(withRestParamsVar, Decl(funcdecl.ts, 39, 3))
|
|
>withRestParams : (a: string, ...myRestParameter: number[]) => number[], Symbol(withRestParams, Decl(funcdecl.ts, 34, 69))
|
|
|
|
function overload1(n: number) : string;
|
|
>overload1 : { (n: number): string; (s: string): string; }, Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
|
|
>n : number, Symbol(n, Decl(funcdecl.ts, 41, 19))
|
|
|
|
function overload1(s: string) : string;
|
|
>overload1 : { (n: number): string; (s: string): string; }, Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
|
|
>s : string, Symbol(s, Decl(funcdecl.ts, 42, 19))
|
|
|
|
function overload1(ns: any) {
|
|
>overload1 : { (n: number): string; (s: string): string; }, Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
|
|
>ns : any, Symbol(ns, Decl(funcdecl.ts, 43, 19))
|
|
|
|
return ns.toString();
|
|
>ns.toString() : any
|
|
>ns.toString : any
|
|
>ns : any, Symbol(ns, Decl(funcdecl.ts, 43, 19))
|
|
>toString : any
|
|
}
|
|
var withOverloadSignature = overload1;
|
|
>withOverloadSignature : { (n: number): string; (s: string): string; }, Symbol(withOverloadSignature, Decl(funcdecl.ts, 46, 3))
|
|
>overload1 : { (n: number): string; (s: string): string; }, Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
|
|
|
|
function f(n: () => void) { }
|
|
>f : (n: () => void) => void, Symbol(f, Decl(funcdecl.ts, 46, 38))
|
|
>n : () => void, Symbol(n, Decl(funcdecl.ts, 48, 11))
|
|
|
|
module m2 {
|
|
>m2 : typeof m2, Symbol(m2, Decl(funcdecl.ts, 48, 29))
|
|
|
|
export function foo(n: () => void ) {
|
|
>foo : (n: () => void) => void, Symbol(foo, Decl(funcdecl.ts, 50, 11))
|
|
>n : () => void, Symbol(n, Decl(funcdecl.ts, 51, 24))
|
|
}
|
|
|
|
}
|
|
|
|
m2.foo(() => {
|
|
>m2.foo(() => { var b = 30; return b;}) : void
|
|
>m2.foo : (n: () => void) => void, Symbol(m2.foo, Decl(funcdecl.ts, 50, 11))
|
|
>m2 : typeof m2, Symbol(m2, Decl(funcdecl.ts, 48, 29))
|
|
>foo : (n: () => void) => void, Symbol(m2.foo, Decl(funcdecl.ts, 50, 11))
|
|
>() => { var b = 30; return b;} : () => number
|
|
|
|
var b = 30;
|
|
>b : number, Symbol(b, Decl(funcdecl.ts, 58, 7))
|
|
>30 : number
|
|
|
|
return b;
|
|
>b : number, Symbol(b, Decl(funcdecl.ts, 58, 7))
|
|
|
|
});
|
|
|
|
|
|
declare function fooAmbient(n: number): string;
|
|
>fooAmbient : (n: number) => string, Symbol(fooAmbient, Decl(funcdecl.ts, 60, 3))
|
|
>n : number, Symbol(n, Decl(funcdecl.ts, 63, 28))
|
|
|
|
declare function overloadAmbient(n: number): string;
|
|
>overloadAmbient : { (n: number): string; (s: string): string; }, Symbol(overloadAmbient, Decl(funcdecl.ts, 63, 47), Decl(funcdecl.ts, 65, 52))
|
|
>n : number, Symbol(n, Decl(funcdecl.ts, 65, 33))
|
|
|
|
declare function overloadAmbient(s: string): string;
|
|
>overloadAmbient : { (n: number): string; (s: string): string; }, Symbol(overloadAmbient, Decl(funcdecl.ts, 63, 47), Decl(funcdecl.ts, 65, 52))
|
|
>s : string, Symbol(s, Decl(funcdecl.ts, 66, 33))
|
|
|
|
var f2 = () => {
|
|
>f2 : () => string, Symbol(f2, Decl(funcdecl.ts, 68, 3))
|
|
>() => { return "string";} : () => string
|
|
|
|
return "string";
|
|
>"string" : string
|
|
}
|