130 lines
4.1 KiB
Text
130 lines
4.1 KiB
Text
=== tests/cases/compiler/thisInPropertyBoundDeclarations.ts ===
|
|
class Bug {
|
|
>Bug : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0))
|
|
|
|
private name: string;
|
|
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11))
|
|
|
|
private static func: Function[] = [
|
|
>func : Symbol(Bug.func, Decl(thisInPropertyBoundDeclarations.ts, 1, 25))
|
|
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
|
|
|
|
(that: Bug, name: string) => {
|
|
>that : Symbol(that, Decl(thisInPropertyBoundDeclarations.ts, 4, 6))
|
|
>Bug : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0))
|
|
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 4, 16))
|
|
|
|
that.foo(name);
|
|
>that.foo : Symbol(foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6))
|
|
>that : Symbol(that, Decl(thisInPropertyBoundDeclarations.ts, 4, 6))
|
|
>foo : Symbol(foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6))
|
|
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 4, 16))
|
|
}
|
|
];
|
|
|
|
private foo(name: string) {
|
|
>foo : Symbol(foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6))
|
|
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 9, 16))
|
|
|
|
this.name = name;
|
|
>this.name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11))
|
|
>this : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0))
|
|
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11))
|
|
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 9, 16))
|
|
}
|
|
}
|
|
|
|
// Valid use of this in a property bound decl
|
|
class A {
|
|
>A : Symbol(A, Decl(thisInPropertyBoundDeclarations.ts, 12, 1))
|
|
|
|
prop1 = function() {
|
|
>prop1 : Symbol(prop1, Decl(thisInPropertyBoundDeclarations.ts, 15, 9))
|
|
|
|
this;
|
|
};
|
|
|
|
prop2 = function() {
|
|
>prop2 : Symbol(prop2, Decl(thisInPropertyBoundDeclarations.ts, 18, 6))
|
|
|
|
function inner() {
|
|
>inner : Symbol(inner, Decl(thisInPropertyBoundDeclarations.ts, 20, 24))
|
|
|
|
this;
|
|
}
|
|
() => this;
|
|
};
|
|
|
|
prop3 = () => {
|
|
>prop3 : Symbol(prop3, Decl(thisInPropertyBoundDeclarations.ts, 25, 6))
|
|
|
|
function inner() {
|
|
>inner : Symbol(inner, Decl(thisInPropertyBoundDeclarations.ts, 27, 19))
|
|
|
|
this;
|
|
}
|
|
};
|
|
|
|
prop4 = {
|
|
>prop4 : Symbol(prop4, Decl(thisInPropertyBoundDeclarations.ts, 31, 6))
|
|
|
|
a: function() { return this; },
|
|
>a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 33, 13))
|
|
|
|
};
|
|
|
|
prop5 = () => {
|
|
>prop5 : Symbol(prop5, Decl(thisInPropertyBoundDeclarations.ts, 35, 6))
|
|
|
|
return {
|
|
a: function() { return this; },
|
|
>a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 38, 16))
|
|
|
|
};
|
|
};
|
|
}
|
|
|
|
class B {
|
|
>B : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
prop1 = this;
|
|
>prop1 : Symbol(prop1, Decl(thisInPropertyBoundDeclarations.ts, 44, 9))
|
|
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
prop2 = () => this;
|
|
>prop2 : Symbol(prop2, Decl(thisInPropertyBoundDeclarations.ts, 45, 17))
|
|
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
prop3 = () => () => () => () => this;
|
|
>prop3 : Symbol(prop3, Decl(thisInPropertyBoundDeclarations.ts, 47, 23))
|
|
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
prop4 = ' ' +
|
|
>prop4 : Symbol(prop4, Decl(thisInPropertyBoundDeclarations.ts, 49, 41))
|
|
|
|
function() {
|
|
} +
|
|
' ' +
|
|
(() => () => () => this);
|
|
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
prop5 = {
|
|
>prop5 : Symbol(prop5, Decl(thisInPropertyBoundDeclarations.ts, 55, 29))
|
|
|
|
a: () => { return this; }
|
|
>a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 57, 13))
|
|
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
};
|
|
|
|
prop6 = () => {
|
|
>prop6 : Symbol(prop6, Decl(thisInPropertyBoundDeclarations.ts, 59, 6))
|
|
|
|
return {
|
|
a: () => { return this; }
|
|
>a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 62, 16))
|
|
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
|
|
|
|
};
|
|
};
|
|
}
|