1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
=== tests/cases/compiler/funcdecl.ts ===
function simpleFunc() {
>simpleFunc : Symbol(simpleFunc, Decl(funcdecl.ts, 0, 0))
return "this is my simple func";
}
var simpleFuncVar = simpleFunc;
>simpleFuncVar : Symbol(simpleFuncVar, Decl(funcdecl.ts, 3, 3))
>simpleFunc : Symbol(simpleFunc, Decl(funcdecl.ts, 0, 0))
function anotherFuncNoReturn() {
>anotherFuncNoReturn : Symbol(anotherFuncNoReturn, Decl(funcdecl.ts, 3, 31))
}
var anotherFuncNoReturnVar = anotherFuncNoReturn;
>anotherFuncNoReturnVar : Symbol(anotherFuncNoReturnVar, Decl(funcdecl.ts, 7, 3))
>anotherFuncNoReturn : Symbol(anotherFuncNoReturn, Decl(funcdecl.ts, 3, 31))
function withReturn() : string{
>withReturn : Symbol(withReturn, Decl(funcdecl.ts, 7, 49))
return "Hello";
}
var withReturnVar = withReturn;
>withReturnVar : Symbol(withReturnVar, Decl(funcdecl.ts, 12, 3))
>withReturn : Symbol(withReturn, Decl(funcdecl.ts, 7, 49))
function withParams(a : string) : string{
>withParams : Symbol(withParams, Decl(funcdecl.ts, 12, 31))
>a : Symbol(a, Decl(funcdecl.ts, 14, 20))
return a;
>a : Symbol(a, Decl(funcdecl.ts, 14, 20))
}
var withparamsVar = withParams;
>withparamsVar : Symbol(withparamsVar, Decl(funcdecl.ts, 17, 3))
>withParams : Symbol(withParams, Decl(funcdecl.ts, 12, 31))
function withMultiParams(a : number, b, c: Object) {
>withMultiParams : Symbol(withMultiParams, Decl(funcdecl.ts, 17, 31))
>a : Symbol(a, Decl(funcdecl.ts, 19, 25))
>b : Symbol(b, Decl(funcdecl.ts, 19, 36))
>c : Symbol(c, Decl(funcdecl.ts, 19, 39))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
return a;
>a : Symbol(a, Decl(funcdecl.ts, 19, 25))
}
var withMultiParamsVar = withMultiParams;
>withMultiParamsVar : Symbol(withMultiParamsVar, Decl(funcdecl.ts, 22, 3))
>withMultiParams : Symbol(withMultiParams, Decl(funcdecl.ts, 17, 31))
function withOptionalParams(a?: string) {
>withOptionalParams : Symbol(withOptionalParams, Decl(funcdecl.ts, 22, 41))
>a : Symbol(a, Decl(funcdecl.ts, 24, 28))
}
var withOptionalParamsVar = withOptionalParams;
>withOptionalParamsVar : Symbol(withOptionalParamsVar, Decl(funcdecl.ts, 26, 3))
>withOptionalParams : Symbol(withOptionalParams, Decl(funcdecl.ts, 22, 41))
function withInitializedParams(a: string, b0, b = 30, c = "string value") {
>withInitializedParams : Symbol(withInitializedParams, Decl(funcdecl.ts, 26, 47))
>a : Symbol(a, Decl(funcdecl.ts, 28, 31))
>b0 : Symbol(b0, Decl(funcdecl.ts, 28, 41))
>b : Symbol(b, Decl(funcdecl.ts, 28, 45))
>c : Symbol(c, Decl(funcdecl.ts, 28, 53))
}
var withInitializedParamsVar = withInitializedParams;
>withInitializedParamsVar : Symbol(withInitializedParamsVar, Decl(funcdecl.ts, 30, 3))
>withInitializedParams : Symbol(withInitializedParams, Decl(funcdecl.ts, 26, 47))
function withOptionalInitializedParams(a: string, c: string = "hello string") {
>withOptionalInitializedParams : Symbol(withOptionalInitializedParams, Decl(funcdecl.ts, 30, 53))
>a : Symbol(a, Decl(funcdecl.ts, 32, 39))
>c : Symbol(c, Decl(funcdecl.ts, 32, 49))
}
var withOptionalInitializedParamsVar = withOptionalInitializedParams;
>withOptionalInitializedParamsVar : Symbol(withOptionalInitializedParamsVar, Decl(funcdecl.ts, 34, 3))
>withOptionalInitializedParams : Symbol(withOptionalInitializedParams, Decl(funcdecl.ts, 30, 53))
function withRestParams(a: string, ... myRestParameter : number[]) {
>withRestParams : Symbol(withRestParams, Decl(funcdecl.ts, 34, 69))
>a : Symbol(a, Decl(funcdecl.ts, 36, 24))
>myRestParameter : Symbol(myRestParameter, Decl(funcdecl.ts, 36, 34))
return myRestParameter;
>myRestParameter : Symbol(myRestParameter, Decl(funcdecl.ts, 36, 34))
}
var withRestParamsVar = withRestParams;
>withRestParamsVar : Symbol(withRestParamsVar, Decl(funcdecl.ts, 39, 3))
>withRestParams : Symbol(withRestParams, Decl(funcdecl.ts, 34, 69))
function overload1(n: number) : string;
>overload1 : Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
>n : Symbol(n, Decl(funcdecl.ts, 41, 19))
function overload1(s: string) : string;
>overload1 : Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
>s : Symbol(s, Decl(funcdecl.ts, 42, 19))
function overload1(ns: any) {
>overload1 : Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
>ns : Symbol(ns, Decl(funcdecl.ts, 43, 19))
return ns.toString();
>ns : Symbol(ns, Decl(funcdecl.ts, 43, 19))
}
var withOverloadSignature = overload1;
>withOverloadSignature : Symbol(withOverloadSignature, Decl(funcdecl.ts, 46, 3))
>overload1 : Symbol(overload1, Decl(funcdecl.ts, 39, 39), Decl(funcdecl.ts, 41, 39), Decl(funcdecl.ts, 42, 39))
function f(n: () => void) { }
>f : Symbol(f, Decl(funcdecl.ts, 46, 38))
>n : Symbol(n, Decl(funcdecl.ts, 48, 11))
module m2 {
>m2 : Symbol(m2, Decl(funcdecl.ts, 48, 29))
export function foo(n: () => void ) {
>foo : Symbol(foo, Decl(funcdecl.ts, 50, 11))
>n : Symbol(n, Decl(funcdecl.ts, 51, 24))
}
}
m2.foo(() => {
>m2.foo : Symbol(m2.foo, Decl(funcdecl.ts, 50, 11))
>m2 : Symbol(m2, Decl(funcdecl.ts, 48, 29))
>foo : Symbol(m2.foo, Decl(funcdecl.ts, 50, 11))
var b = 30;
>b : Symbol(b, Decl(funcdecl.ts, 58, 7))
return b;
>b : Symbol(b, Decl(funcdecl.ts, 58, 7))
});
declare function fooAmbient(n: number): string;
>fooAmbient : Symbol(fooAmbient, Decl(funcdecl.ts, 60, 3))
>n : Symbol(n, Decl(funcdecl.ts, 63, 28))
declare function overloadAmbient(n: number): string;
>overloadAmbient : Symbol(overloadAmbient, Decl(funcdecl.ts, 63, 47), Decl(funcdecl.ts, 65, 52))
>n : Symbol(n, Decl(funcdecl.ts, 65, 33))
declare function overloadAmbient(s: string): string;
>overloadAmbient : Symbol(overloadAmbient, Decl(funcdecl.ts, 63, 47), Decl(funcdecl.ts, 65, 52))
>s : Symbol(s, Decl(funcdecl.ts, 66, 33))
var f2 = () => {
>f2 : Symbol(f2, Decl(funcdecl.ts, 68, 3))
return "string";
}
|