swc/crates/swc_ecma_parser/tests/tsc/privateNameComputedPropertyName3.ts
2022-02-04 17:08:38 +09:00

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));