mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 11:11:30 +03:00
26 lines
387 B
TypeScript
26 lines
387 B
TypeScript
// @target: esnext, es2022, es2015
|
|
|
|
class Foo {
|
|
#name;
|
|
|
|
constructor(name) {
|
|
this.#name = name;
|
|
}
|
|
|
|
getValue(x) {
|
|
const obj = this;
|
|
|
|
class Bar {
|
|
#y = 100;
|
|
|
|
[obj.#name]() {
|
|
return x + this.#y;
|
|
}
|
|
}
|
|
|
|
return new Bar()[obj.#name]();
|
|
}
|
|
}
|
|
|
|
console.log(new Foo("NAME").getValue(100));
|