• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//// [privateNameStaticMethodClassExpression.ts]
2const C = class D {
3    static #field = D.#method();
4    static #method() { return 42; }
5    static getClass() { return D; }
6    static getField() { return C.#field };
7}
8
9console.log(C.getClass().getField());
10C.getClass().#method; // Error
11C.getClass().#field; // Error
12
13
14
15//// [privateNameStaticMethodClassExpression.js]
16var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20};
21var _a, _D_field, _D_method;
22const C = (_a = class D {
23        static getClass() { return D; }
24        static getField() { return __classPrivateFieldGet(C, _a, "f", _D_field); }
25        ;
26    },
27    _D_method = function _D_method() { return 42; },
28    _D_field = { value: __classPrivateFieldGet(_a, _a, "m", _D_method).call(_a) },
29    _a);
30console.log(C.getClass().getField());
31C.getClass().; // Error
32C.getClass().; // Error
33