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
|
=== tests/cases/compiler/thisInPropertyBoundDeclarations.ts ===
class Bug {
>Bug : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0))
private name: string;
>name : Symbol(Bug.name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11))
private static func: Function[] = [
>func : Symbol(Bug.func, Decl(thisInPropertyBoundDeclarations.ts, 1, 25))
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
(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(Bug.foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6))
>that : Symbol(that, Decl(thisInPropertyBoundDeclarations.ts, 4, 6))
>foo : Symbol(Bug.foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6))
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 4, 16))
}
];
private foo(name: string) {
>foo : Symbol(Bug.foo, Decl(thisInPropertyBoundDeclarations.ts, 7, 6))
>name : Symbol(name, Decl(thisInPropertyBoundDeclarations.ts, 9, 16))
this.name = name;
>this.name : Symbol(Bug.name, Decl(thisInPropertyBoundDeclarations.ts, 0, 11))
>this : Symbol(Bug, Decl(thisInPropertyBoundDeclarations.ts, 0, 0))
>name : Symbol(Bug.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(A.prop1, Decl(thisInPropertyBoundDeclarations.ts, 15, 9))
this;
};
prop2 = function() {
>prop2 : Symbol(A.prop2, Decl(thisInPropertyBoundDeclarations.ts, 18, 6))
function inner() {
>inner : Symbol(inner, Decl(thisInPropertyBoundDeclarations.ts, 20, 24))
this;
}
() => this;
};
prop3 = () => {
>prop3 : Symbol(A.prop3, Decl(thisInPropertyBoundDeclarations.ts, 25, 6))
function inner() {
>inner : Symbol(inner, Decl(thisInPropertyBoundDeclarations.ts, 27, 19))
this;
}
};
prop4 = {
>prop4 : Symbol(A.prop4, Decl(thisInPropertyBoundDeclarations.ts, 31, 6))
a: function() { return this; },
>a : Symbol(a, Decl(thisInPropertyBoundDeclarations.ts, 33, 13))
};
prop5 = () => {
>prop5 : Symbol(A.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(B.prop1, Decl(thisInPropertyBoundDeclarations.ts, 44, 9))
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
prop2 = () => this;
>prop2 : Symbol(B.prop2, Decl(thisInPropertyBoundDeclarations.ts, 45, 17))
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
prop3 = () => () => () => () => this;
>prop3 : Symbol(B.prop3, Decl(thisInPropertyBoundDeclarations.ts, 47, 23))
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
prop4 = ' ' +
>prop4 : Symbol(B.prop4, Decl(thisInPropertyBoundDeclarations.ts, 49, 41))
function() {
} +
' ' +
(() => () => () => this);
>this : Symbol(B, Decl(thisInPropertyBoundDeclarations.ts, 42, 1))
prop5 = {
>prop5 : Symbol(B.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(B.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))
};
};
}
|