TypeScript/tests/baselines/reference/thisInPropertyBoundDeclarations.types

176 lines
3.7 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/thisInPropertyBoundDeclarations.ts ===
class Bug {
>Bug : Bug
2014-08-15 23:33:16 +02:00
private name: string;
>name : string
2014-08-15 23:33:16 +02:00
private static func: Function[] = [
>func : Function[]
>Function : Function
>[ (that: Bug, name: string) => { that.foo(name); } ] : ((that: Bug, name: string) => void)[]
2014-08-15 23:33:16 +02:00
(that: Bug, name: string) => {
2014-08-22 03:39:46 +02:00
>(that: Bug, name: string) => { that.foo(name); } : (that: Bug, name: string) => void
>that : Bug
>Bug : Bug
>name : string
2014-08-15 23:33:16 +02:00
that.foo(name);
>that.foo(name) : void
>that.foo : (name: string) => void
>that : Bug
>foo : (name: string) => void
>name : string
2014-08-15 23:33:16 +02:00
}
];
private foo(name: string) {
>foo : (name: string) => void
>name : string
2014-08-15 23:33:16 +02:00
this.name = name;
>this.name = name : string
>this.name : string
>this : Bug
>name : string
>name : string
2014-08-15 23:33:16 +02:00
}
}
// Valid use of this in a property bound decl
class A {
>A : A
2014-08-15 23:33:16 +02:00
prop1 = function() {
>prop1 : () => void
2014-08-22 03:39:46 +02:00
>function() { this; } : () => void
2014-08-15 23:33:16 +02:00
this;
>this : any
};
prop2 = function() {
>prop2 : () => void
2014-08-22 03:39:46 +02:00
>function() { function inner() { this; } () => this; } : () => void
2014-08-15 23:33:16 +02:00
function inner() {
>inner : () => void
2014-08-15 23:33:16 +02:00
this;
>this : any
}
() => this;
>() => this : () => any
>this : any
};
prop3 = () => {
>prop3 : () => void
2014-08-22 03:39:46 +02:00
>() => { function inner() { this; } } : () => void
2014-08-15 23:33:16 +02:00
function inner() {
>inner : () => void
2014-08-15 23:33:16 +02:00
this;
>this : any
}
};
prop4 = {
>prop4 : { a: () => any; }
2014-08-22 03:39:46 +02:00
>{ a: function() { return this; }, } : { a: () => any; }
2014-08-15 23:33:16 +02:00
a: function() { return this; },
>a : () => any
2014-08-15 23:33:16 +02:00
>function() { return this; } : () => any
>this : any
};
prop5 = () => {
>prop5 : () => { a: () => any; }
2014-08-22 03:39:46 +02:00
>() => { return { a: function() { return this; }, }; } : () => { a: () => any; }
2014-08-15 23:33:16 +02:00
return {
2014-08-22 03:39:46 +02:00
>{ a: function() { return this; }, } : { a: () => any; }
2014-08-15 23:33:16 +02:00
a: function() { return this; },
>a : () => any
2014-08-15 23:33:16 +02:00
>function() { return this; } : () => any
>this : any
};
};
}
class B {
>B : B
2014-08-15 23:33:16 +02:00
prop1 = this;
>prop1 : B
>this : B
2014-08-15 23:33:16 +02:00
prop2 = () => this;
>prop2 : () => B
2014-08-15 23:33:16 +02:00
>() => this : () => B
>this : B
2014-08-15 23:33:16 +02:00
prop3 = () => () => () => () => this;
>prop3 : () => () => () => () => B
2014-08-15 23:33:16 +02:00
>() => () => () => () => this : () => () => () => () => B
>() => () => () => this : () => () => () => B
>() => () => this : () => () => B
>() => this : () => B
>this : B
2014-08-15 23:33:16 +02:00
prop4 = ' ' +
>prop4 : string
2014-08-22 03:39:46 +02:00
>' ' + function() { } + ' ' + (() => () => () => this) : string
>' ' + function() { } + ' ' : string
>' ' + function() { } : string
2015-04-13 21:36:11 +02:00
>' ' : string
2014-08-15 23:33:16 +02:00
function() {
2014-08-22 03:39:46 +02:00
>function() { } : () => void
2014-08-15 23:33:16 +02:00
} +
' ' +
2015-04-13 21:36:11 +02:00
>' ' : string
2014-08-15 23:33:16 +02:00
(() => () => () => this);
>(() => () => () => this) : () => () => () => B
>() => () => () => this : () => () => () => B
>() => () => this : () => () => B
>() => this : () => B
>this : B
2014-08-15 23:33:16 +02:00
prop5 = {
>prop5 : { a: () => B; }
2014-08-22 03:39:46 +02:00
>{ a: () => { return this; } } : { a: () => B; }
2014-08-15 23:33:16 +02:00
a: () => { return this; }
>a : () => B
2014-08-15 23:33:16 +02:00
>() => { return this; } : () => B
>this : B
2014-08-15 23:33:16 +02:00
};
prop6 = () => {
>prop6 : () => { a: () => B; }
2014-08-22 03:39:46 +02:00
>() => { return { a: () => { return this; } }; } : () => { a: () => B; }
2014-08-15 23:33:16 +02:00
return {
2014-08-22 03:39:46 +02:00
>{ a: () => { return this; } } : { a: () => B; }
2014-08-15 23:33:16 +02:00
a: () => { return this; }
>a : () => B
2014-08-15 23:33:16 +02:00
>() => { return this; } : () => B
>this : B
2014-08-15 23:33:16 +02:00
};
};
}