mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 21:21:31 +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));
|