mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
1.6 KiB
Plaintext
35 lines
1.6 KiB
Plaintext
//// [tests/cases/compiler/classMemberInitializerWithLamdaScoping2.ts] ////
|
|
|
|
=== classMemberInitializerWithLamdaScoping2_0.ts ===
|
|
var field1: string;
|
|
>field1 : Symbol(field1, Decl(classMemberInitializerWithLamdaScoping2_0.ts, 0, 3))
|
|
|
|
=== classMemberInitializerWithLamdaScoping2_1.ts ===
|
|
declare var console: {
|
|
>console : Symbol(console, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 0, 11))
|
|
|
|
log(msg?: any): void;
|
|
>log : Symbol(log, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 0, 22))
|
|
>msg : Symbol(msg, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 1, 8))
|
|
|
|
};
|
|
class Test1 {
|
|
>Test1 : Symbol(Test1, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 2, 2))
|
|
|
|
constructor(private field1: string) {
|
|
>field1 : Symbol(Test1.field1, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 4, 16))
|
|
}
|
|
messageHandler = () => {
|
|
>messageHandler : Symbol(Test1.messageHandler, Decl(classMemberInitializerWithLamdaScoping2_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(classMemberInitializerWithLamdaScoping2_1.ts, 0, 22))
|
|
>console : Symbol(console, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 0, 11))
|
|
>log : Symbol(log, Decl(classMemberInitializerWithLamdaScoping2_1.ts, 0, 22))
|
|
>field1 : Symbol(field1, Decl(classMemberInitializerWithLamdaScoping2_0.ts, 0, 3))
|
|
|
|
// 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.
|
|
};
|
|
}
|