diff --git a/packages/babel-helper-create-class-features-plugin/src/fields.js b/packages/babel-helper-create-class-features-plugin/src/fields.js index 98babe2635b8..76bc96b6d662 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.js +++ b/packages/babel-helper-create-class-features-plugin/src/fields.js @@ -300,7 +300,13 @@ const privateNameHandlerSpec = { // The first access (the get) should do the memo assignment. this.memoise(member, 1); - return optimiseCall(this.get(member), this.receiver(member), args); + return optimiseCall(this.get(member), this.receiver(member), args, false); + }, + + optionalCall(member, args) { + this.memoise(member, 1); + + return optimiseCall(this.get(member), this.receiver(member), args, true); }, }; @@ -328,6 +334,10 @@ const privateNameHandlerLoose = { call(member, args) { return t.callExpression(this.get(member), args); }, + + optionalCall(member, args) { + return t.optionalCallExpression(this.get(member), args, true); + }, }; export function transformPrivateNamesUsage( diff --git a/packages/babel-helper-member-expression-to-functions/src/index.js b/packages/babel-helper-member-expression-to-functions/src/index.js index ae63cafaed67..48f23fb3bb46 100644 --- a/packages/babel-helper-member-expression-to-functions/src/index.js +++ b/packages/babel-helper-member-expression-to-functions/src/index.js @@ -109,7 +109,11 @@ const handle = { if (parentPath.isOptionalCallExpression()) { // Checking `parent.callee` since we could be in the arguments, eg // `bad?.(FOO?.BAR)`. - return parent.optional || parent.callee !== node; + // Also skip `FOO?.BAR` in `FOO?.BAR?.()` since we need to transform the optional call to ensure proper this + return ( + // In FOO?.#BAR?.(), endPath points the optional call expression so we skip FOO?.#BAR + (node !== member.node && parent.optional) || parent.callee !== node + ); } return true; }); @@ -145,7 +149,9 @@ const handle = { continue; } // prevent infinite loop: unreachable if the AST is well-formed - throw new Error("Internal error"); + throw new Error( + `Internal error: unexpected ${startingOptional.node.type}`, + ); } const { scope } = member; @@ -163,7 +169,11 @@ const handle = { }); startingOptional.replaceWith(toNonOptional(startingOptional, baseRef)); if (parentIsOptionalCall) { - parentPath.replaceWith(this.call(member, parent.arguments)); + if (parent.optional) { + parentPath.replaceWith(this.optionalCall(member, parent.arguments)); + } else { + parentPath.replaceWith(this.call(member, parent.arguments)); + } } else { member.replaceWith(this.get(member)); } @@ -171,6 +181,11 @@ const handle = { let regular = member.node; for (let current = member; current !== endPath; ) { const { parentPath } = current; + // skip transforming `Foo.#BAR?.call(FOO)` + if (parentPath === endPath && parentIsOptionalCall && parent.optional) { + regular = parentPath.node; + break; + } regular = toNonOptional(parentPath, regular); current = parentPath; } @@ -299,6 +314,12 @@ const handle = { return; } + // MEMBER?.(ARGS) -> _optionalCall(MEMBER, ARGS) + if (parentPath.isOptionalCallExpression({ callee: node })) { + parentPath.replaceWith(this.optionalCall(member, parent.arguments)); + return; + } + // { KEY: MEMBER } = OBJ -> { KEY: _destructureSet(MEMBER) } = OBJ // { KEY: MEMBER = _VALUE } = OBJ -> { KEY: _destructureSet(MEMBER) = _VALUE } = OBJ // {...MEMBER} -> {..._destructureSet(MEMBER)} diff --git a/packages/babel-helper-optimise-call-expression/src/index.js b/packages/babel-helper-optimise-call-expression/src/index.js index 56f9b2991bde..2dcfd29ec852 100644 --- a/packages/babel-helper-optimise-call-expression/src/index.js +++ b/packages/babel-helper-optimise-call-expression/src/index.js @@ -1,6 +1,6 @@ import * as t from "@babel/types"; -export default function(callee, thisNode, args) { +export default function(callee, thisNode, args, optional) { if ( args.length === 1 && t.isSpreadElement(args[0]) && @@ -12,6 +12,13 @@ export default function(callee, thisNode, args) { args[0].argument, ]); } else { + if (optional) { + return t.optionalCallExpression( + t.optionalMemberExpression(callee, t.identifier("call"), false, true), + [thisNode, ...args], + false, + ); + } return t.callExpression(t.memberExpression(callee, t.identifier("call")), [ thisNode, ...args, diff --git a/packages/babel-helper-replace-supers/src/index.js b/packages/babel-helper-replace-supers/src/index.js index 804d4251805b..0bf1d50c3d35 100644 --- a/packages/babel-helper-replace-supers/src/index.js +++ b/packages/babel-helper-replace-supers/src/index.js @@ -158,6 +158,7 @@ const specHandlers = { this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args, + false, ); }, }; @@ -215,7 +216,7 @@ const looseHandlers = { }, call(superMember, args) { - return optimiseCall(this.get(superMember), t.thisExpression(), args); + return optimiseCall(this.get(superMember), t.thisExpression(), args, false); }, }; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/input.js index 42d692812e9a..11dd4a57060d 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/input.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/input.js @@ -66,9 +66,6 @@ class Foo { fn?.().Foo.#self?.getSelf?.()?.self.#m?.(); } - static testtest() { - fn?.().Foo.#self.getSelf?.().#m?.(); - } } Foo.test(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/output.js index 3eb9ff618c8a..349cb4e9e213 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call-with-transform/output.js @@ -8,7 +8,7 @@ class Foo { } static test() { - var _o$Foo, _o$Foo2, _o$Foo3, _deep$very$o, _deep$very$o$Foo, _deep$very$o2, _deep$very$o2$Foo, _deep$very$o3, _deep$very$o3$Foo, _classStaticPrivateFi, _classStaticPrivateFi2, _ref, _ref$self, _ref2, _ref2$self, _self2, _self2$self, _classStaticPrivateFi3, _classStaticPrivateFi4, _ref3, _ref3$call, _ref4, _ref4$getSelf, _getSelf, _ref5, _getSelf$call, _ref6, _ref6$self, _classStaticPrivateFi5, _call, _call$self, _getSelf2, _getSelf2$self, _getSelf3, _getSelf3$self, _fn$Foo, _fn$Foo2, _fn$Foo3, _fnDeep$very$o, _fnDeep$very$o$Foo, _fnDeep$very$o2, _fnDeep$very$o2$Foo, _fnDeep$very$o3, _fnDeep$very$o3$Foo, _classStaticPrivateFi6, _classStaticPrivateFi7, _ref7, _ref7$self, _ref8, _ref8$self, _self3, _self3$self, _classStaticPrivateFi8, _classStaticPrivateFi9, _ref9, _ref9$call, _ref10, _ref10$getSelf, _getSelf4, _ref11, _getSelf4$call, _ref12, _ref12$self, _classStaticPrivateFi10, _call2, _call2$self, _getSelf5, _getSelf5$self, _getSelf6, _getSelf6$self; + var _o$Foo, _o$Foo2, _o$Foo3, _deep$very$o, _deep$very$o$Foo, _deep$very$o2, _deep$very$o2$Foo, _deep$very$o3, _deep$very$o3$Foo, _classStaticPrivateFi, _classStaticPrivateFi2, _ref, _ref$self, _ref2, _ref2$self, _self2, _self2$self, _classStaticPrivateFi3, _classStaticPrivateFi4, _ref3, _ref3$call, _ref4, _ref4$getSelf, _getSelf, _ref5, _getSelf$call, _ref6, _ref6$self, _classStaticPrivateFi5, _call, _call$self, _getSelf2, _getSelf2$self, _getSelf3, _getSelf3$self, _fn$Foo, _fn$Foo2, _fn$Foo3, _fnDeep$very$o, _fnDeep$very$o$Foo, _fnDeep$very$o2, _fnDeep$very$o2$Foo, _fnDeep$very$o3, _fnDeep$very$o3$Foo, _classStaticPrivateFi6, _classStaticPrivateFi7, _ref7, _ref7$self, _ref8, _ref8$self, _self3, _self3$self, _classStaticPrivateFi8, _classStaticPrivateFi9, _ref9, _ref9$call, _ref10, _ref10$getSelf, _getSelf4, _ref11, _getSelf4$call, _ref12, _ref12$self, _classStaticPrivateFi10, _call2, _call2$self, _getSelf5, _getSelf5$self, _getSelf6, _getSelf6$self, _classStaticPrivateFi11, _classStaticPrivateFi12, _classStaticPrivateFi13, _classStaticPrivateFi14, _classStaticPrivateFi15, _classStaticPrivateFi16, _classStaticPrivateFi17, _classStaticPrivateFi18, _classStaticPrivateFi19, _ref13, _ref14, _classStaticPrivateFi20, _classStaticPrivateFi21, _ref15, _classStaticPrivateFi22, _ref16, _classStaticPrivateFi23, _classStaticPrivateFi24, _ref17, _classStaticPrivateFi25, _classStaticPrivateFi26, _ref18, _classStaticPrivateFi27, _ref19, _classStaticPrivateFi28, _ref20, _ref20$getSelf, _classStaticPrivateFi29, _classStaticPrivateFi30, _classStaticPrivateFi31, _classStaticPrivateFi32, _classStaticPrivateFi33, _classStaticPrivateFi34, _classStaticPrivateFi35, _ref21, _ref22, _classStaticPrivateFi36, _classStaticPrivateFi37, _ref23, _classStaticPrivateFi38, _ref24, _classStaticPrivateFi39, _classStaticPrivateFi40, _ref25, _classStaticPrivateFi41, _classStaticPrivateFi42, _ref26, _classStaticPrivateFi43, _ref27, _classStaticPrivateFi44, _ref28, _ref28$getSelf, _classStaticPrivateFi45; const o = { Foo: Foo @@ -27,83 +27,47 @@ class Foo { return deep; } - _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.(); - _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.().toString; - _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.().toString(); - - _classStaticPrivateFieldSpecGet(_o$Foo = o.Foo, Foo, _m).call(_o$Foo); - - _classStaticPrivateFieldSpecGet(_o$Foo2 = o.Foo, Foo, _m).call(_o$Foo2).toString; - _classStaticPrivateFieldSpecGet(_o$Foo3 = o.Foo, Foo, _m).call(_o$Foo3).toString(); - - _classStaticPrivateFieldSpecGet(_deep$very$o$Foo = _deep$very$o.Foo, Foo, _m).call(_deep$very$o$Foo); - - _classStaticPrivateFieldSpecGet(_deep$very$o2$Foo = _deep$very$o2.Foo, Foo, _m).call(_deep$very$o2$Foo).toString; - _classStaticPrivateFieldSpecGet(_deep$very$o3$Foo = _deep$very$o3.Foo, Foo, _m).call(_deep$very$o3$Foo).toString(); - (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self), Foo, _m))?.call(_classStaticPrivateFi); - (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi2 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).self, Foo, _m))?.call(_classStaticPrivateFi2); - - _classStaticPrivateFieldSpecGet(_ref$self = _ref.self, Foo, _m).call(_ref$self); - - _classStaticPrivateFieldSpecGet(_ref2$self = _ref2.self, Foo, _m).call(_ref2$self); - - _classStaticPrivateFieldSpecGet(_self2$self = _self2.self, Foo, _m).call(_self2$self); - - (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi3 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).getSelf(), Foo, _m))?.call(_classStaticPrivateFi3); - - _classStaticPrivateFieldSpecGet(_ref3$call = _ref3.call(_classStaticPrivateFi4), Foo, _m).call(_ref3$call); - - _classStaticPrivateFieldSpecGet(_ref4$getSelf = _ref4.getSelf(), Foo, _m).call(_ref4$getSelf); - - _classStaticPrivateFieldSpecGet(_getSelf$call = _getSelf.call(_ref5), Foo, _m).call(_getSelf$call); - - _classStaticPrivateFieldSpecGet(_ref6$self = _ref6.self, Foo, _m).call(_ref6$self); - - _classStaticPrivateFieldSpecGet(_call$self = _call.self, Foo, _m).call(_call$self); - - _classStaticPrivateFieldSpecGet(_getSelf2$self = _getSelf2.self, Foo, _m).call(_getSelf2$self); - - _classStaticPrivateFieldSpecGet(_getSelf3$self = _getSelf3.self, Foo, _m).call(_getSelf3$self); - - _classStaticPrivateFieldSpecGet(_fn$Foo = fn().Foo, Foo, _m).call(_fn$Foo); - - _classStaticPrivateFieldSpecGet(_fn$Foo2 = fn().Foo, Foo, _m).call(_fn$Foo2).toString; - _classStaticPrivateFieldSpecGet(_fn$Foo3 = fn().Foo, Foo, _m).call(_fn$Foo3).toString(); - - _classStaticPrivateFieldSpecGet(_fnDeep$very$o$Foo = _fnDeep$very$o.Foo, Foo, _m).call(_fnDeep$very$o$Foo); - - _classStaticPrivateFieldSpecGet(_fnDeep$very$o2$Foo = _fnDeep$very$o2.Foo, Foo, _m).call(_fnDeep$very$o2$Foo).toString; - _classStaticPrivateFieldSpecGet(_fnDeep$very$o3$Foo = _fnDeep$very$o3.Foo, Foo, _m).call(_fnDeep$very$o3$Foo).toString(); - (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi6 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self), Foo, _m))?.call(_classStaticPrivateFi6); - (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi7 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).self, Foo, _m))?.call(_classStaticPrivateFi7); - - _classStaticPrivateFieldSpecGet(_ref7$self = _ref7.self, Foo, _m).call(_ref7$self); - - _classStaticPrivateFieldSpecGet(_ref8$self = _ref8.self, Foo, _m).call(_ref8$self); - - _classStaticPrivateFieldSpecGet(_self3$self = _self3.self, Foo, _m).call(_self3$self); - - (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi8 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).getSelf(), Foo, _m))?.call(_classStaticPrivateFi8); - - _classStaticPrivateFieldSpecGet(_ref9$call = _ref9.call(_classStaticPrivateFi9), Foo, _m).call(_ref9$call); - - _classStaticPrivateFieldSpecGet(_ref10$getSelf = _ref10.getSelf(), Foo, _m).call(_ref10$getSelf); - - _classStaticPrivateFieldSpecGet(_getSelf4$call = _getSelf4.call(_ref11), Foo, _m).call(_getSelf4$call); - - _classStaticPrivateFieldSpecGet(_ref12$self = _ref12.self, Foo, _m).call(_ref12$self); - - _classStaticPrivateFieldSpecGet(_call2$self = _call2.self, Foo, _m).call(_call2$self); - - _classStaticPrivateFieldSpecGet(_getSelf5$self = _getSelf5.self, Foo, _m).call(_getSelf5$self); - - _classStaticPrivateFieldSpecGet(_getSelf6$self = _getSelf6.self, Foo, _m).call(_getSelf6$self); - } - - static testtest() { - var _fn, _classStaticPrivateFi11, _ref13, _ref13$call; - - _classStaticPrivateFieldSpecGet(_ref13$call = _ref13.call(_classStaticPrivateFi11), Foo, _m).call(_ref13$call); + (_classStaticPrivateFi11 = _classStaticPrivateFieldSpecGet(Foo, Foo, _m)) === null || _classStaticPrivateFi11 === void 0 ? void 0 : _classStaticPrivateFi11.call(Foo); + (_classStaticPrivateFi12 = _classStaticPrivateFieldSpecGet(Foo, Foo, _m)) === null || _classStaticPrivateFi12 === void 0 ? void 0 : _classStaticPrivateFi12.call(Foo).toString; + (_classStaticPrivateFi13 = _classStaticPrivateFieldSpecGet(Foo, Foo, _m)) === null || _classStaticPrivateFi13 === void 0 ? void 0 : _classStaticPrivateFi13.call(Foo).toString(); + o === null || o === void 0 ? void 0 : (_classStaticPrivateFi14 = _classStaticPrivateFieldSpecGet(_o$Foo = o.Foo, Foo, _m)) === null || _classStaticPrivateFi14 === void 0 ? void 0 : _classStaticPrivateFi14.call(_o$Foo); + o === null || o === void 0 ? void 0 : (_classStaticPrivateFi15 = _classStaticPrivateFieldSpecGet(_o$Foo2 = o.Foo, Foo, _m)) === null || _classStaticPrivateFi15 === void 0 ? void 0 : _classStaticPrivateFi15.call(_o$Foo2).toString; + o === null || o === void 0 ? void 0 : (_classStaticPrivateFi16 = _classStaticPrivateFieldSpecGet(_o$Foo3 = o.Foo, Foo, _m)) === null || _classStaticPrivateFi16 === void 0 ? void 0 : _classStaticPrivateFi16.call(_o$Foo3).toString(); + (_deep$very$o = deep === null || deep === void 0 ? void 0 : deep.very.o) === null || _deep$very$o === void 0 ? void 0 : (_classStaticPrivateFi17 = _classStaticPrivateFieldSpecGet(_deep$very$o$Foo = _deep$very$o.Foo, Foo, _m)) === null || _classStaticPrivateFi17 === void 0 ? void 0 : _classStaticPrivateFi17.call(_deep$very$o$Foo); + (_deep$very$o2 = deep === null || deep === void 0 ? void 0 : deep.very.o) === null || _deep$very$o2 === void 0 ? void 0 : (_classStaticPrivateFi18 = _classStaticPrivateFieldSpecGet(_deep$very$o2$Foo = _deep$very$o2.Foo, Foo, _m)) === null || _classStaticPrivateFi18 === void 0 ? void 0 : _classStaticPrivateFi18.call(_deep$very$o2$Foo).toString; + (_deep$very$o3 = deep === null || deep === void 0 ? void 0 : deep.very.o) === null || _deep$very$o3 === void 0 ? void 0 : (_classStaticPrivateFi19 = _classStaticPrivateFieldSpecGet(_deep$very$o3$Foo = _deep$very$o3.Foo, Foo, _m)) === null || _classStaticPrivateFi19 === void 0 ? void 0 : _classStaticPrivateFi19.call(_deep$very$o3$Foo).toString(); + (_ref13 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self), Foo, _m)) === null || _ref13 === void 0 ? void 0 : _ref13.call(_classStaticPrivateFi); + (_ref14 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi2 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).self, Foo, _m)) === null || _ref14 === void 0 ? void 0 : _ref14.call(_classStaticPrivateFi2); + (_ref = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref === void 0 ? void 0 : (_classStaticPrivateFi20 = _classStaticPrivateFieldSpecGet(_ref$self = _ref.self, Foo, _m)) === null || _classStaticPrivateFi20 === void 0 ? void 0 : _classStaticPrivateFi20.call(_ref$self); + (_ref2 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).self) === null || _ref2 === void 0 ? void 0 : (_classStaticPrivateFi21 = _classStaticPrivateFieldSpecGet(_ref2$self = _ref2.self, Foo, _m)) === null || _classStaticPrivateFi21 === void 0 ? void 0 : _classStaticPrivateFi21.call(_ref2$self); + (_self2 = (_ref15 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref15 === void 0 ? void 0 : _ref15.self) === null || _self2 === void 0 ? void 0 : (_classStaticPrivateFi22 = _classStaticPrivateFieldSpecGet(_self2$self = _self2.self, Foo, _m)) === null || _classStaticPrivateFi22 === void 0 ? void 0 : _classStaticPrivateFi22.call(_self2$self); + (_ref16 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi3 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).getSelf(), Foo, _m)) === null || _ref16 === void 0 ? void 0 : _ref16.call(_classStaticPrivateFi3); + (_ref3 = o === null || o === void 0 ? void 0 : (_classStaticPrivateFi4 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)).getSelf) === null || _ref3 === void 0 ? void 0 : (_classStaticPrivateFi23 = _classStaticPrivateFieldSpecGet(_ref3$call = _ref3.call(_classStaticPrivateFi4), Foo, _m)) === null || _classStaticPrivateFi23 === void 0 ? void 0 : _classStaticPrivateFi23.call(_ref3$call); + (_ref4 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref4 === void 0 ? void 0 : (_classStaticPrivateFi24 = _classStaticPrivateFieldSpecGet(_ref4$getSelf = _ref4.getSelf(), Foo, _m)) === null || _classStaticPrivateFi24 === void 0 ? void 0 : _classStaticPrivateFi24.call(_ref4$getSelf); + (_getSelf = (_ref17 = _ref5 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref17 === void 0 ? void 0 : _ref17.getSelf) === null || _getSelf === void 0 ? void 0 : (_classStaticPrivateFi25 = _classStaticPrivateFieldSpecGet(_getSelf$call = _getSelf.call(_ref5), Foo, _m)) === null || _classStaticPrivateFi25 === void 0 ? void 0 : _classStaticPrivateFi25.call(_getSelf$call); + (_ref6 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).getSelf()) === null || _ref6 === void 0 ? void 0 : (_classStaticPrivateFi26 = _classStaticPrivateFieldSpecGet(_ref6$self = _ref6.self, Foo, _m)) === null || _classStaticPrivateFi26 === void 0 ? void 0 : _classStaticPrivateFi26.call(_ref6$self); + (_call = (_ref18 = o === null || o === void 0 ? void 0 : (_classStaticPrivateFi5 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)).getSelf) === null || _ref18 === void 0 ? void 0 : _ref18.call(_classStaticPrivateFi5)) === null || _call === void 0 ? void 0 : (_classStaticPrivateFi27 = _classStaticPrivateFieldSpecGet(_call$self = _call.self, Foo, _m)) === null || _classStaticPrivateFi27 === void 0 ? void 0 : _classStaticPrivateFi27.call(_call$self); + (_getSelf2 = (_ref19 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref19 === void 0 ? void 0 : _ref19.getSelf()) === null || _getSelf2 === void 0 ? void 0 : (_classStaticPrivateFi28 = _classStaticPrivateFieldSpecGet(_getSelf2$self = _getSelf2.self, Foo, _m)) === null || _classStaticPrivateFi28 === void 0 ? void 0 : _classStaticPrivateFi28.call(_getSelf2$self); + (_getSelf3 = (_ref20 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref20 === void 0 ? void 0 : (_ref20$getSelf = _ref20.getSelf) === null || _ref20$getSelf === void 0 ? void 0 : _ref20$getSelf.call(_ref20)) === null || _getSelf3 === void 0 ? void 0 : (_classStaticPrivateFi29 = _classStaticPrivateFieldSpecGet(_getSelf3$self = _getSelf3.self, Foo, _m)) === null || _classStaticPrivateFi29 === void 0 ? void 0 : _classStaticPrivateFi29.call(_getSelf3$self); + fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi30 = _classStaticPrivateFieldSpecGet(_fn$Foo = fn().Foo, Foo, _m)) === null || _classStaticPrivateFi30 === void 0 ? void 0 : _classStaticPrivateFi30.call(_fn$Foo); + fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi31 = _classStaticPrivateFieldSpecGet(_fn$Foo2 = fn().Foo, Foo, _m)) === null || _classStaticPrivateFi31 === void 0 ? void 0 : _classStaticPrivateFi31.call(_fn$Foo2).toString; + fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi32 = _classStaticPrivateFieldSpecGet(_fn$Foo3 = fn().Foo, Foo, _m)) === null || _classStaticPrivateFi32 === void 0 ? void 0 : _classStaticPrivateFi32.call(_fn$Foo3).toString(); + (_fnDeep$very$o = fnDeep === null || fnDeep === void 0 ? void 0 : fnDeep().very.o) === null || _fnDeep$very$o === void 0 ? void 0 : (_classStaticPrivateFi33 = _classStaticPrivateFieldSpecGet(_fnDeep$very$o$Foo = _fnDeep$very$o.Foo, Foo, _m)) === null || _classStaticPrivateFi33 === void 0 ? void 0 : _classStaticPrivateFi33.call(_fnDeep$very$o$Foo); + (_fnDeep$very$o2 = fnDeep === null || fnDeep === void 0 ? void 0 : fnDeep().very.o) === null || _fnDeep$very$o2 === void 0 ? void 0 : (_classStaticPrivateFi34 = _classStaticPrivateFieldSpecGet(_fnDeep$very$o2$Foo = _fnDeep$very$o2.Foo, Foo, _m)) === null || _classStaticPrivateFi34 === void 0 ? void 0 : _classStaticPrivateFi34.call(_fnDeep$very$o2$Foo).toString; + (_fnDeep$very$o3 = fnDeep === null || fnDeep === void 0 ? void 0 : fnDeep().very.o) === null || _fnDeep$very$o3 === void 0 ? void 0 : (_classStaticPrivateFi35 = _classStaticPrivateFieldSpecGet(_fnDeep$very$o3$Foo = _fnDeep$very$o3.Foo, Foo, _m)) === null || _classStaticPrivateFi35 === void 0 ? void 0 : _classStaticPrivateFi35.call(_fnDeep$very$o3$Foo).toString(); + (_ref21 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi6 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self), Foo, _m)) === null || _ref21 === void 0 ? void 0 : _ref21.call(_classStaticPrivateFi6); + (_ref22 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi7 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).self, Foo, _m)) === null || _ref22 === void 0 ? void 0 : _ref22.call(_classStaticPrivateFi7); + (_ref7 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref7 === void 0 ? void 0 : (_classStaticPrivateFi36 = _classStaticPrivateFieldSpecGet(_ref7$self = _ref7.self, Foo, _m)) === null || _classStaticPrivateFi36 === void 0 ? void 0 : _classStaticPrivateFi36.call(_ref7$self); + (_ref8 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).self) === null || _ref8 === void 0 ? void 0 : (_classStaticPrivateFi37 = _classStaticPrivateFieldSpecGet(_ref8$self = _ref8.self, Foo, _m)) === null || _classStaticPrivateFi37 === void 0 ? void 0 : _classStaticPrivateFi37.call(_ref8$self); + (_self3 = (_ref23 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref23 === void 0 ? void 0 : _ref23.self) === null || _self3 === void 0 ? void 0 : (_classStaticPrivateFi38 = _classStaticPrivateFieldSpecGet(_self3$self = _self3.self, Foo, _m)) === null || _classStaticPrivateFi38 === void 0 ? void 0 : _classStaticPrivateFi38.call(_self3$self); + (_ref24 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi8 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).getSelf(), Foo, _m)) === null || _ref24 === void 0 ? void 0 : _ref24.call(_classStaticPrivateFi8); + (_ref9 = fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi9 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)).getSelf) === null || _ref9 === void 0 ? void 0 : (_classStaticPrivateFi39 = _classStaticPrivateFieldSpecGet(_ref9$call = _ref9.call(_classStaticPrivateFi9), Foo, _m)) === null || _classStaticPrivateFi39 === void 0 ? void 0 : _classStaticPrivateFi39.call(_ref9$call); + (_ref10 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref10 === void 0 ? void 0 : (_classStaticPrivateFi40 = _classStaticPrivateFieldSpecGet(_ref10$getSelf = _ref10.getSelf(), Foo, _m)) === null || _classStaticPrivateFi40 === void 0 ? void 0 : _classStaticPrivateFi40.call(_ref10$getSelf); + (_getSelf4 = (_ref25 = _ref11 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref25 === void 0 ? void 0 : _ref25.getSelf) === null || _getSelf4 === void 0 ? void 0 : (_classStaticPrivateFi41 = _classStaticPrivateFieldSpecGet(_getSelf4$call = _getSelf4.call(_ref11), Foo, _m)) === null || _classStaticPrivateFi41 === void 0 ? void 0 : _classStaticPrivateFi41.call(_getSelf4$call); + (_ref12 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).getSelf()) === null || _ref12 === void 0 ? void 0 : (_classStaticPrivateFi42 = _classStaticPrivateFieldSpecGet(_ref12$self = _ref12.self, Foo, _m)) === null || _classStaticPrivateFi42 === void 0 ? void 0 : _classStaticPrivateFi42.call(_ref12$self); + (_call2 = (_ref26 = fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi10 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)).getSelf) === null || _ref26 === void 0 ? void 0 : _ref26.call(_classStaticPrivateFi10)) === null || _call2 === void 0 ? void 0 : (_classStaticPrivateFi43 = _classStaticPrivateFieldSpecGet(_call2$self = _call2.self, Foo, _m)) === null || _classStaticPrivateFi43 === void 0 ? void 0 : _classStaticPrivateFi43.call(_call2$self); + (_getSelf5 = (_ref27 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref27 === void 0 ? void 0 : _ref27.getSelf()) === null || _getSelf5 === void 0 ? void 0 : (_classStaticPrivateFi44 = _classStaticPrivateFieldSpecGet(_getSelf5$self = _getSelf5.self, Foo, _m)) === null || _classStaticPrivateFi44 === void 0 ? void 0 : _classStaticPrivateFi44.call(_getSelf5$self); + (_getSelf6 = (_ref28 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref28 === void 0 ? void 0 : (_ref28$getSelf = _ref28.getSelf) === null || _ref28$getSelf === void 0 ? void 0 : _ref28$getSelf.call(_ref28)) === null || _getSelf6 === void 0 ? void 0 : (_classStaticPrivateFi45 = _classStaticPrivateFieldSpecGet(_getSelf6$self = _getSelf6.self, Foo, _m)) === null || _classStaticPrivateFi45 === void 0 ? void 0 : _classStaticPrivateFi45.call(_getSelf6$self); } } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/input.js index 42d692812e9a..11dd4a57060d 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/input.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/input.js @@ -66,9 +66,6 @@ class Foo { fn?.().Foo.#self?.getSelf?.()?.self.#m?.(); } - static testtest() { - fn?.().Foo.#self.getSelf?.().#m?.(); - } } Foo.test(); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/output.js index 3eb9ff618c8a..c9e4dcb46a81 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/optional-chain-member-optional-call/output.js @@ -27,83 +27,47 @@ class Foo { return deep; } - _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.(); - _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.().toString; - _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.().toString(); - - _classStaticPrivateFieldSpecGet(_o$Foo = o.Foo, Foo, _m).call(_o$Foo); - - _classStaticPrivateFieldSpecGet(_o$Foo2 = o.Foo, Foo, _m).call(_o$Foo2).toString; - _classStaticPrivateFieldSpecGet(_o$Foo3 = o.Foo, Foo, _m).call(_o$Foo3).toString(); - - _classStaticPrivateFieldSpecGet(_deep$very$o$Foo = _deep$very$o.Foo, Foo, _m).call(_deep$very$o$Foo); - - _classStaticPrivateFieldSpecGet(_deep$very$o2$Foo = _deep$very$o2.Foo, Foo, _m).call(_deep$very$o2$Foo).toString; - _classStaticPrivateFieldSpecGet(_deep$very$o3$Foo = _deep$very$o3.Foo, Foo, _m).call(_deep$very$o3$Foo).toString(); + _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.call(Foo); + _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.call(Foo).toString; + _classStaticPrivateFieldSpecGet(Foo, Foo, _m)?.call(Foo).toString(); + o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_o$Foo = o.Foo, Foo, _m)?.call(_o$Foo); + o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_o$Foo2 = o.Foo, Foo, _m)?.call(_o$Foo2).toString; + o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_o$Foo3 = o.Foo, Foo, _m)?.call(_o$Foo3).toString(); + (_deep$very$o = deep?.very.o) === null || _deep$very$o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_deep$very$o$Foo = _deep$very$o.Foo, Foo, _m)?.call(_deep$very$o$Foo); + (_deep$very$o2 = deep?.very.o) === null || _deep$very$o2 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_deep$very$o2$Foo = _deep$very$o2.Foo, Foo, _m)?.call(_deep$very$o2$Foo).toString; + (_deep$very$o3 = deep?.very.o) === null || _deep$very$o3 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_deep$very$o3$Foo = _deep$very$o3.Foo, Foo, _m)?.call(_deep$very$o3$Foo).toString(); (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self), Foo, _m))?.call(_classStaticPrivateFi); (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi2 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).self, Foo, _m))?.call(_classStaticPrivateFi2); - - _classStaticPrivateFieldSpecGet(_ref$self = _ref.self, Foo, _m).call(_ref$self); - - _classStaticPrivateFieldSpecGet(_ref2$self = _ref2.self, Foo, _m).call(_ref2$self); - - _classStaticPrivateFieldSpecGet(_self2$self = _self2.self, Foo, _m).call(_self2$self); - + (_ref = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref$self = _ref.self, Foo, _m)?.call(_ref$self); + (_ref2 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).self) === null || _ref2 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref2$self = _ref2.self, Foo, _m)?.call(_ref2$self); + (_self2 = (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self))?.self) === null || _self2 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_self2$self = _self2.self, Foo, _m)?.call(_self2$self); (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi3 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).getSelf(), Foo, _m))?.call(_classStaticPrivateFi3); - - _classStaticPrivateFieldSpecGet(_ref3$call = _ref3.call(_classStaticPrivateFi4), Foo, _m).call(_ref3$call); - - _classStaticPrivateFieldSpecGet(_ref4$getSelf = _ref4.getSelf(), Foo, _m).call(_ref4$getSelf); - - _classStaticPrivateFieldSpecGet(_getSelf$call = _getSelf.call(_ref5), Foo, _m).call(_getSelf$call); - - _classStaticPrivateFieldSpecGet(_ref6$self = _ref6.self, Foo, _m).call(_ref6$self); - - _classStaticPrivateFieldSpecGet(_call$self = _call.self, Foo, _m).call(_call$self); - - _classStaticPrivateFieldSpecGet(_getSelf2$self = _getSelf2.self, Foo, _m).call(_getSelf2$self); - - _classStaticPrivateFieldSpecGet(_getSelf3$self = _getSelf3.self, Foo, _m).call(_getSelf3$self); - - _classStaticPrivateFieldSpecGet(_fn$Foo = fn().Foo, Foo, _m).call(_fn$Foo); - - _classStaticPrivateFieldSpecGet(_fn$Foo2 = fn().Foo, Foo, _m).call(_fn$Foo2).toString; - _classStaticPrivateFieldSpecGet(_fn$Foo3 = fn().Foo, Foo, _m).call(_fn$Foo3).toString(); - - _classStaticPrivateFieldSpecGet(_fnDeep$very$o$Foo = _fnDeep$very$o.Foo, Foo, _m).call(_fnDeep$very$o$Foo); - - _classStaticPrivateFieldSpecGet(_fnDeep$very$o2$Foo = _fnDeep$very$o2.Foo, Foo, _m).call(_fnDeep$very$o2$Foo).toString; - _classStaticPrivateFieldSpecGet(_fnDeep$very$o3$Foo = _fnDeep$very$o3.Foo, Foo, _m).call(_fnDeep$very$o3$Foo).toString(); + (_ref3 = o === null || o === void 0 ? void 0 : (_classStaticPrivateFi4 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)).getSelf) === null || _ref3 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref3$call = _ref3.call(_classStaticPrivateFi4), Foo, _m)?.call(_ref3$call); + (_ref4 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)) === null || _ref4 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref4$getSelf = _ref4.getSelf(), Foo, _m)?.call(_ref4$getSelf); + (_getSelf = (_ref5 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self))?.getSelf) === null || _getSelf === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_getSelf$call = _getSelf.call(_ref5), Foo, _m)?.call(_getSelf$call); + (_ref6 = o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).getSelf()) === null || _ref6 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref6$self = _ref6.self, Foo, _m)?.call(_ref6$self); + (_call = (o === null || o === void 0 ? void 0 : (_classStaticPrivateFi5 = _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self)).getSelf)?.call(_classStaticPrivateFi5)) === null || _call === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_call$self = _call.self, Foo, _m)?.call(_call$self); + (_getSelf2 = (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self))?.getSelf()) === null || _getSelf2 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_getSelf2$self = _getSelf2.self, Foo, _m)?.call(_getSelf2$self); + (_getSelf3 = (o === null || o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(o.Foo, Foo, _self))?.getSelf?.()) === null || _getSelf3 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_getSelf3$self = _getSelf3.self, Foo, _m)?.call(_getSelf3$self); + fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_fn$Foo = fn().Foo, Foo, _m)?.call(_fn$Foo); + fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_fn$Foo2 = fn().Foo, Foo, _m)?.call(_fn$Foo2).toString; + fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_fn$Foo3 = fn().Foo, Foo, _m)?.call(_fn$Foo3).toString(); + (_fnDeep$very$o = fnDeep?.().very.o) === null || _fnDeep$very$o === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_fnDeep$very$o$Foo = _fnDeep$very$o.Foo, Foo, _m)?.call(_fnDeep$very$o$Foo); + (_fnDeep$very$o2 = fnDeep?.().very.o) === null || _fnDeep$very$o2 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_fnDeep$very$o2$Foo = _fnDeep$very$o2.Foo, Foo, _m)?.call(_fnDeep$very$o2$Foo).toString; + (_fnDeep$very$o3 = fnDeep?.().very.o) === null || _fnDeep$very$o3 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_fnDeep$very$o3$Foo = _fnDeep$very$o3.Foo, Foo, _m)?.call(_fnDeep$very$o3$Foo).toString(); (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi6 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self), Foo, _m))?.call(_classStaticPrivateFi6); (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi7 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).self, Foo, _m))?.call(_classStaticPrivateFi7); - - _classStaticPrivateFieldSpecGet(_ref7$self = _ref7.self, Foo, _m).call(_ref7$self); - - _classStaticPrivateFieldSpecGet(_ref8$self = _ref8.self, Foo, _m).call(_ref8$self); - - _classStaticPrivateFieldSpecGet(_self3$self = _self3.self, Foo, _m).call(_self3$self); - + (_ref7 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref7 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref7$self = _ref7.self, Foo, _m)?.call(_ref7$self); + (_ref8 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).self) === null || _ref8 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref8$self = _ref8.self, Foo, _m)?.call(_ref8$self); + (_self3 = (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self))?.self) === null || _self3 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_self3$self = _self3.self, Foo, _m)?.call(_self3$self); (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_classStaticPrivateFi8 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).getSelf(), Foo, _m))?.call(_classStaticPrivateFi8); - - _classStaticPrivateFieldSpecGet(_ref9$call = _ref9.call(_classStaticPrivateFi9), Foo, _m).call(_ref9$call); - - _classStaticPrivateFieldSpecGet(_ref10$getSelf = _ref10.getSelf(), Foo, _m).call(_ref10$getSelf); - - _classStaticPrivateFieldSpecGet(_getSelf4$call = _getSelf4.call(_ref11), Foo, _m).call(_getSelf4$call); - - _classStaticPrivateFieldSpecGet(_ref12$self = _ref12.self, Foo, _m).call(_ref12$self); - - _classStaticPrivateFieldSpecGet(_call2$self = _call2.self, Foo, _m).call(_call2$self); - - _classStaticPrivateFieldSpecGet(_getSelf5$self = _getSelf5.self, Foo, _m).call(_getSelf5$self); - - _classStaticPrivateFieldSpecGet(_getSelf6$self = _getSelf6.self, Foo, _m).call(_getSelf6$self); - } - - static testtest() { - var _fn, _classStaticPrivateFi11, _ref13, _ref13$call; - - _classStaticPrivateFieldSpecGet(_ref13$call = _ref13.call(_classStaticPrivateFi11), Foo, _m).call(_ref13$call); + (_ref9 = fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi9 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)).getSelf) === null || _ref9 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref9$call = _ref9.call(_classStaticPrivateFi9), Foo, _m)?.call(_ref9$call); + (_ref10 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)) === null || _ref10 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref10$getSelf = _ref10.getSelf(), Foo, _m)?.call(_ref10$getSelf); + (_getSelf4 = (_ref11 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self))?.getSelf) === null || _getSelf4 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_getSelf4$call = _getSelf4.call(_ref11), Foo, _m)?.call(_getSelf4$call); + (_ref12 = fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).getSelf()) === null || _ref12 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_ref12$self = _ref12.self, Foo, _m)?.call(_ref12$self); + (_call2 = (fn === null || fn === void 0 ? void 0 : (_classStaticPrivateFi10 = _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self)).getSelf)?.call(_classStaticPrivateFi10)) === null || _call2 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_call2$self = _call2.self, Foo, _m)?.call(_call2$self); + (_getSelf5 = (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self))?.getSelf()) === null || _getSelf5 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_getSelf5$self = _getSelf5.self, Foo, _m)?.call(_getSelf5$self); + (_getSelf6 = (fn === null || fn === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self))?.getSelf?.()) === null || _getSelf6 === void 0 ? void 0 : _classStaticPrivateFieldSpecGet(_getSelf6$self = _getSelf6.self, Foo, _m)?.call(_getSelf6$self); } }