* fix: ensure (a?.b)() has proper this * let test be more restrictive * fix: transformed member call should preserve computed * chore: revamp test files * refactor: simplify * fix: unwrap parthenthesizedExpression * add loose test cases * add `(a?.#b)()` support * add with-transform test cases * Update packages/babel-plugin-proposal-optional-chaining/src/index.js Co-authored-by: Justin Ridgewell <justin@ridgewell.name> * address review comments * update test fixtures Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
31 lines
565 B
JavaScript
31 lines
565 B
JavaScript
class Foo {
|
|
static #x = 1;
|
|
|
|
static self = Foo;
|
|
static #m = function() { return this.#x; };
|
|
static getSelf() { return Foo }
|
|
|
|
test() {
|
|
const o = { Foo: Foo };
|
|
const fn = function () {
|
|
return o;
|
|
};
|
|
|
|
(Foo?.#m)();
|
|
(Foo?.#m)().toString;
|
|
(Foo?.#m)().toString();
|
|
|
|
(o?.Foo.#m)();
|
|
(o?.Foo.#m)().toString;
|
|
(o?.Foo.#m)().toString();
|
|
|
|
(((o.Foo?.self.getSelf)())?.#m)();
|
|
(((o.Foo.self?.getSelf)())?.#m)();
|
|
|
|
(((fn()?.Foo?.self.getSelf)())?.#m)();
|
|
(((fn?.().Foo.self?.getSelf)())?.#m)();
|
|
}
|
|
}
|
|
|
|
(new Foo).test();
|