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
|
=== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts ===
var field1: string;
>field1 : Symbol(field1, Decl(classMemberInitializerWithLamdaScoping3_0.ts, 0, 3))
=== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts ===
declare var console: {
>console : Symbol(console, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 0, 11))
log(msg?: any): void;
>log : Symbol(log, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 0, 22))
>msg : Symbol(msg, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 1, 8))
};
export class Test1 {
>Test1 : Symbol(Test1, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 2, 2))
constructor(private field1: string) {
>field1 : Symbol(Test1.field1, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 4, 16))
}
messageHandler = () => {
>messageHandler : Symbol(Test1.messageHandler, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 5, 5))
console.log(field1); // But this should be error as the field1 will resolve to var field1
>console.log : Symbol(log, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 0, 22))
>console : Symbol(console, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 0, 11))
>log : Symbol(log, Decl(classMemberInitializerWithLamdaScoping3_1.ts, 0, 22))
// but since this code would be generated inside constructor, in generated js
// it would resolve to private field1 and thats not what user intended here.
};
}
|