45 lines
1.2 KiB
Text
45 lines
1.2 KiB
Text
=== tests/cases/compiler/thisInLambda.ts ===
|
|
class Foo {
|
|
>Foo : Symbol(Foo, Decl(thisInLambda.ts, 0, 0))
|
|
|
|
x = "hello";
|
|
>x : Symbol(x, Decl(thisInLambda.ts, 0, 11))
|
|
|
|
bar() {
|
|
>bar : Symbol(bar, Decl(thisInLambda.ts, 1, 16))
|
|
|
|
this.x; // 'this' is type 'Foo'
|
|
>this.x : Symbol(x, Decl(thisInLambda.ts, 0, 11))
|
|
>this : Symbol(Foo, Decl(thisInLambda.ts, 0, 0))
|
|
>x : Symbol(x, Decl(thisInLambda.ts, 0, 11))
|
|
|
|
var f = () => this.x; // 'this' should be type 'Foo' as well
|
|
>f : Symbol(f, Decl(thisInLambda.ts, 4, 11))
|
|
>this.x : Symbol(x, Decl(thisInLambda.ts, 0, 11))
|
|
>this : Symbol(Foo, Decl(thisInLambda.ts, 0, 0))
|
|
>x : Symbol(x, Decl(thisInLambda.ts, 0, 11))
|
|
}
|
|
}
|
|
|
|
function myFn(a:any) { }
|
|
>myFn : Symbol(myFn, Decl(thisInLambda.ts, 6, 1))
|
|
>a : Symbol(a, Decl(thisInLambda.ts, 8, 14))
|
|
|
|
class myCls {
|
|
>myCls : Symbol(myCls, Decl(thisInLambda.ts, 8, 24))
|
|
|
|
constructor () {
|
|
myFn(() => {
|
|
>myFn : Symbol(myFn, Decl(thisInLambda.ts, 6, 1))
|
|
|
|
myFn(() => {
|
|
>myFn : Symbol(myFn, Decl(thisInLambda.ts, 6, 1))
|
|
|
|
var x = this;
|
|
>x : Symbol(x, Decl(thisInLambda.ts, 13, 19))
|
|
>this : Symbol(myCls, Decl(thisInLambda.ts, 8, 24))
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|