mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
44 lines
833 B
TypeScript
44 lines
833 B
TypeScript
//// [tests/cases/compiler/capturedLetConstInLoop13.ts] ////
|
|
|
|
//// [capturedLetConstInLoop13.ts]
|
|
class Main {
|
|
|
|
constructor() {
|
|
this.register("a", "b", "c");
|
|
}
|
|
|
|
private register(...names: string[]): void {
|
|
for (let name of names) {
|
|
|
|
this.bar({
|
|
[name + ".a"]: () => { this.foo(name); },
|
|
});
|
|
}
|
|
}
|
|
|
|
private bar(a: any): void { }
|
|
|
|
private foo(name: string): void { }
|
|
|
|
}
|
|
|
|
new Main();
|
|
|
|
//// [capturedLetConstInLoop13.js]
|
|
"use strict";
|
|
class Main {
|
|
constructor() {
|
|
this.register("a", "b", "c");
|
|
}
|
|
register(...names) {
|
|
for (let name of names) {
|
|
this.bar({
|
|
[name + ".a"]: () => { this.foo(name); },
|
|
});
|
|
}
|
|
}
|
|
bar(a) { }
|
|
foo(name) { }
|
|
}
|
|
new Main();
|