TypeScript/tests/baselines/reference/thisInObjectLiterals.symbols
2015-04-15 16:44:20 -07:00

43 lines
1.6 KiB
Plaintext

=== tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts ===
class MyClass {
>MyClass : Symbol(MyClass, Decl(thisInObjectLiterals.ts, 0, 0))
t: number;
>t : Symbol(t, Decl(thisInObjectLiterals.ts, 0, 15))
fn() {
>fn : Symbol(fn, Decl(thisInObjectLiterals.ts, 1, 14))
//type of 'this' in an object literal is the containing scope's this
var t = { x: this, y: this.t };
>t : Symbol(t, Decl(thisInObjectLiterals.ts, 5, 11), Decl(thisInObjectLiterals.ts, 6, 11))
>x : Symbol(x, Decl(thisInObjectLiterals.ts, 5, 17))
>this : Symbol(MyClass, Decl(thisInObjectLiterals.ts, 0, 0))
>y : Symbol(y, Decl(thisInObjectLiterals.ts, 5, 26))
>this.t : Symbol(t, Decl(thisInObjectLiterals.ts, 0, 15))
>this : Symbol(MyClass, Decl(thisInObjectLiterals.ts, 0, 0))
>t : Symbol(t, Decl(thisInObjectLiterals.ts, 0, 15))
var t: { x: MyClass; y: number };
>t : Symbol(t, Decl(thisInObjectLiterals.ts, 5, 11), Decl(thisInObjectLiterals.ts, 6, 11))
>x : Symbol(x, Decl(thisInObjectLiterals.ts, 6, 16))
>MyClass : Symbol(MyClass, Decl(thisInObjectLiterals.ts, 0, 0))
>y : Symbol(y, Decl(thisInObjectLiterals.ts, 6, 28))
}
}
//type of 'this' in an object literal property of a function type is Any
var obj = {
>obj : Symbol(obj, Decl(thisInObjectLiterals.ts, 11, 3), Decl(thisInObjectLiterals.ts, 16, 3))
f() {
>f : Symbol(f, Decl(thisInObjectLiterals.ts, 11, 11))
return this.spaaace;
}
};
var obj: { f: () => any; };
>obj : Symbol(obj, Decl(thisInObjectLiterals.ts, 11, 3), Decl(thisInObjectLiterals.ts, 16, 3))
>f : Symbol(f, Decl(thisInObjectLiterals.ts, 16, 10))