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

176 lines
3.7 KiB
Plaintext

=== tests/cases/compiler/thisInPropertyBoundDeclarations.ts ===
class Bug {
>Bug : Bug
private name: string;
>name : string
private static func: Function[] = [
>func : Function[]
>Function : Function
>[ (that: Bug, name: string) => { that.foo(name); } ] : ((that: Bug, name: string) => void)[]
(that: Bug, name: string) => {
>(that: Bug, name: string) => { that.foo(name); } : (that: Bug, name: string) => void
>that : Bug
>Bug : Bug
>name : string
that.foo(name);
>that.foo(name) : void
>that.foo : (name: string) => void
>that : Bug
>foo : (name: string) => void
>name : string
}
];
private foo(name: string) {
>foo : (name: string) => void
>name : string
this.name = name;
>this.name = name : string
>this.name : string
>this : Bug
>name : string
>name : string
}
}
// Valid use of this in a property bound decl
class A {
>A : A
prop1 = function() {
>prop1 : () => void
>function() { this; } : () => void
this;
>this : any
};
prop2 = function() {
>prop2 : () => void
>function() { function inner() { this; } () => this; } : () => void
function inner() {
>inner : () => void
this;
>this : any
}
() => this;
>() => this : () => any
>this : any
};
prop3 = () => {
>prop3 : () => void
>() => { function inner() { this; } } : () => void
function inner() {
>inner : () => void
this;
>this : any
}
};
prop4 = {
>prop4 : { a: () => any; }
>{ a: function() { return this; }, } : { a: () => any; }
a: function() { return this; },
>a : () => any
>function() { return this; } : () => any
>this : any
};
prop5 = () => {
>prop5 : () => { a: () => any; }
>() => { return { a: function() { return this; }, }; } : () => { a: () => any; }
return {
>{ a: function() { return this; }, } : { a: () => any; }
a: function() { return this; },
>a : () => any
>function() { return this; } : () => any
>this : any
};
};
}
class B {
>B : B
prop1 = this;
>prop1 : B
>this : B
prop2 = () => this;
>prop2 : () => B
>() => this : () => B
>this : B
prop3 = () => () => () => () => this;
>prop3 : () => () => () => () => B
>() => () => () => () => this : () => () => () => () => B
>() => () => () => this : () => () => () => B
>() => () => this : () => () => B
>() => this : () => B
>this : B
prop4 = ' ' +
>prop4 : string
>' ' + function() { } + ' ' + (() => () => () => this) : string
>' ' + function() { } + ' ' : string
>' ' + function() { } : string
>' ' : string
function() {
>function() { } : () => void
} +
' ' +
>' ' : string
(() => () => () => this);
>(() => () => () => this) : () => () => () => B
>() => () => () => this : () => () => () => B
>() => () => this : () => () => B
>() => this : () => B
>this : B
prop5 = {
>prop5 : { a: () => B; }
>{ a: () => { return this; } } : { a: () => B; }
a: () => { return this; }
>a : () => B
>() => { return this; } : () => B
>this : B
};
prop6 = () => {
>prop6 : () => { a: () => B; }
>() => { return { a: () => { return this; } }; } : () => { a: () => B; }
return {
>{ a: () => { return this; } } : { a: () => B; }
a: () => { return this; }
>a : () => B
>() => { return this; } : () => B
>this : B
};
};
}