Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
562 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...rties/test/fixtures/private-loose/optional-chain-in-function-param-with-transform/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class Foo { | ||
static #x = 1; | ||
static #m = function() { return this.#x; }; | ||
static #self = Foo; | ||
static self = Foo; | ||
static getSelf() { return this } | ||
|
||
static test() { | ||
const o = { Foo: Foo }; | ||
const deep = { very: { o } }; | ||
function fn() { | ||
return o; | ||
} | ||
function fnDeep() { | ||
return deep; | ||
} | ||
|
||
function f(o, r = o?.Foo.#m()) { | ||
return r; | ||
} | ||
|
||
function g(o, r = o?.Foo.#self.getSelf().#m()) { | ||
return r; | ||
} | ||
|
||
function h(fnDeep, r = fnDeep?.().very.o?.Foo?.#m()) { | ||
return r; | ||
} | ||
|
||
function i(fn, r = fn?.().Foo.#self?.getSelf()?.self.#m()) { | ||
return r; | ||
} | ||
|
||
function j(fn, r = (fn().Foo.#self.getSelf().self.#m)?.()) { | ||
return r; | ||
} | ||
|
||
expect(f(o)).toBe(1); | ||
expect(g(o)).toBe(1); | ||
expect(h(fnDeep)).toBe(1); | ||
expect(i(fn)).toBe(1); | ||
expect(j(fn)).toBe(1); | ||
} | ||
} | ||
|
||
Foo.test(); |
46 changes: 46 additions & 0 deletions
46
...ties/test/fixtures/private-loose/optional-chain-in-function-param-with-transform/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class Foo { | ||
static #x = 1; | ||
static #m = function() { return this.#x; }; | ||
static #self = Foo; | ||
static self = Foo; | ||
static getSelf() { return this } | ||
|
||
static test() { | ||
const o = { Foo: Foo }; | ||
const deep = { very: { o } }; | ||
function fn() { | ||
return o; | ||
} | ||
function fnDeep() { | ||
return deep; | ||
} | ||
|
||
function f(o, r = o?.Foo.#m()) { | ||
return r; | ||
} | ||
|
||
function g(o, r = o?.Foo.#self.getSelf().#m?.()) { | ||
return r; | ||
} | ||
|
||
function h(fnDeep, r = fnDeep?.().very.o?.Foo?.#m()) { | ||
return r; | ||
} | ||
|
||
function i(fn, r = fn?.().Foo.#self?.getSelf()?.self.#m()) { | ||
return r; | ||
} | ||
|
||
function j(fn, r = (fn().Foo.#self.getSelf().self.#m)?.()) { | ||
return r; | ||
} | ||
|
||
f(o); | ||
g(o); | ||
h(fnDeep); | ||
i(fn); | ||
j(fn); | ||
} | ||
} | ||
|
||
Foo.test(); |
92 changes: 92 additions & 0 deletions
92
...ies/test/fixtures/private-loose/optional-chain-in-function-param-with-transform/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
var _x = babelHelpers.classPrivateFieldLooseKey("x"); | ||
|
||
var _m = babelHelpers.classPrivateFieldLooseKey("m"); | ||
|
||
var _self = babelHelpers.classPrivateFieldLooseKey("self"); | ||
|
||
var Foo = /*#__PURE__*/function () { | ||
"use strict"; | ||
|
||
function Foo() { | ||
babelHelpers.classCallCheck(this, Foo); | ||
} | ||
|
||
babelHelpers.createClass(Foo, null, [{ | ||
key: "getSelf", | ||
value: function getSelf() { | ||
return this; | ||
} | ||
}, { | ||
key: "test", | ||
value: function test() { | ||
var o = { | ||
Foo: Foo | ||
}; | ||
var deep = { | ||
very: { | ||
o | ||
} | ||
}; | ||
|
||
function fn() { | ||
return o; | ||
} | ||
|
||
function fnDeep() { | ||
return deep; | ||
} | ||
|
||
function f(o, r = (() => o === null || o === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(o.Foo, _m)[_m]())()) { | ||
return r; | ||
} | ||
|
||
function g(o, r = (() => o === null || o === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(babelHelpers.classPrivateFieldLooseBase(o.Foo, _self)[_self].getSelf(), _m)[_m])()?.()) { | ||
return r; | ||
} | ||
|
||
function h(fnDeep, r = (() => { | ||
var _fnDeep$very$o$Foo; | ||
|
||
return (_fnDeep$very$o$Foo = fnDeep?.().very.o?.Foo) === null || _fnDeep$very$o$Foo === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_fnDeep$very$o$Foo, _m)[_m](); | ||
})()) { | ||
return r; | ||
} | ||
|
||
function i(fn, r = (() => { | ||
var _getSelf; | ||
|
||
return (_getSelf = (() => fn === null || fn === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(fn().Foo, _self)[_self])()?.getSelf()) === null || _getSelf === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_getSelf.self, _m)[_m](); | ||
})()) { | ||
return r; | ||
} | ||
|
||
function j(fn, r = (() => babelHelpers.classPrivateFieldLooseBase(babelHelpers.classPrivateFieldLooseBase(fn().Foo, _self)[_self].getSelf().self, _m)[_m]?.())()) { | ||
return r; | ||
} | ||
|
||
f(o); | ||
g(o); | ||
h(fnDeep); | ||
i(fn); | ||
j(fn); | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
|
||
Object.defineProperty(Foo, _x, { | ||
writable: true, | ||
value: 1 | ||
}); | ||
Object.defineProperty(Foo, _m, { | ||
writable: true, | ||
value: function () { | ||
return babelHelpers.classPrivateFieldLooseBase(this, _x)[_x]; | ||
} | ||
}); | ||
Object.defineProperty(Foo, _self, { | ||
writable: true, | ||
value: Foo | ||
}); | ||
Foo.self = Foo; | ||
Foo.test(); |
46 changes: 46 additions & 0 deletions
46
...sal-class-properties/test/fixtures/private-loose/optional-chain-in-function-param/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class Foo { | ||
static #x = 1; | ||
static #m = function() { return this.#x; }; | ||
static #self = Foo; | ||
static self = Foo; | ||
static getSelf() { return this } | ||
|
||
static test() { | ||
const o = { Foo: Foo }; | ||
const deep = { very: { o } }; | ||
function fn() { | ||
return o; | ||
} | ||
function fnDeep() { | ||
return deep; | ||
} | ||
|
||
function f(o, r = o?.Foo.#m()) { | ||
return r; | ||
} | ||
|
||
function g(o, r = o?.Foo.#self.getSelf().#m()) { | ||
return r; | ||
} | ||
|
||
function h(fnDeep, r = fnDeep?.().very.o?.Foo?.#m()) { | ||
return r; | ||
} | ||
|
||
function i(fn, r = fn?.().Foo.#self?.getSelf()?.self.#m()) { | ||
return r; | ||
} | ||
|
||
function j(fn, r = (fn().Foo.#self.getSelf().self.#m)?.()) { | ||
return r; | ||
} | ||
|
||
expect(f(o)).toBe(1); | ||
expect(g(o)).toBe(1); | ||
expect(h(fnDeep)).toBe(1); | ||
expect(i(fn)).toBe(1); | ||
expect(j(fn)).toBe(1); | ||
} | ||
} | ||
|
||
Foo.test(); |
46 changes: 46 additions & 0 deletions
46
...al-class-properties/test/fixtures/private-loose/optional-chain-in-function-param/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class Foo { | ||
static #x = 1; | ||
static #m = function() { return this.#x; }; | ||
static #self = Foo; | ||
static self = Foo; | ||
static getSelf() { return this } | ||
|
||
static test() { | ||
const o = { Foo: Foo }; | ||
const deep = { very: { o } }; | ||
function fn() { | ||
return o; | ||
} | ||
function fnDeep() { | ||
return deep; | ||
} | ||
|
||
function f(o, r = o?.Foo.#m()) { | ||
return r; | ||
} | ||
|
||
function g(o, r = o?.Foo.#self.getSelf().#m?.()) { | ||
return r; | ||
} | ||
|
||
function h(fnDeep, r = fnDeep?.().very.o?.Foo?.#m()) { | ||
return r; | ||
} | ||
|
||
function i(fn, r = fn?.().Foo.#self?.getSelf()?.self.#m()) { | ||
return r; | ||
} | ||
|
||
function j(fn, r = (fn().Foo.#self.getSelf().self.#m)?.()) { | ||
return r; | ||
} | ||
|
||
f(o); | ||
g(o); | ||
h(fnDeep); | ||
i(fn); | ||
j(fn); | ||
} | ||
} | ||
|
||
Foo.test(); |
4 changes: 4 additions & 0 deletions
4
...lass-properties/test/fixtures/private-loose/optional-chain-in-function-param/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["proposal-class-properties", { "loose": true }]], | ||
"minNodeVersion": "14.0.0" | ||
} |
88 changes: 88 additions & 0 deletions
88
...l-class-properties/test/fixtures/private-loose/optional-chain-in-function-param/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
|
||
var id = 0; | ||
|
||
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; } | ||
|
||
var _x = _classPrivateFieldLooseKey("x"); | ||
|
||
var _m = _classPrivateFieldLooseKey("m"); | ||
|
||
var _self = _classPrivateFieldLooseKey("self"); | ||
|
||
class Foo { | ||
static getSelf() { | ||
return this; | ||
} | ||
|
||
static test() { | ||
const o = { | ||
Foo: Foo | ||
}; | ||
const deep = { | ||
very: { | ||
o | ||
} | ||
}; | ||
|
||
function fn() { | ||
return o; | ||
} | ||
|
||
function fnDeep() { | ||
return deep; | ||
} | ||
|
||
function f(o, r = (() => o === null || o === void 0 ? void 0 : _classPrivateFieldLooseBase(o.Foo, _m)[_m]())()) { | ||
return r; | ||
} | ||
|
||
function g(o, r = (() => o === null || o === void 0 ? void 0 : _classPrivateFieldLooseBase(_classPrivateFieldLooseBase(o.Foo, _self)[_self].getSelf(), _m)[_m])()?.()) { | ||
return r; | ||
} | ||
|
||
function h(fnDeep, r = (() => { | ||
var _fnDeep$very$o$Foo; | ||
|
||
return (_fnDeep$very$o$Foo = fnDeep?.().very.o?.Foo) === null || _fnDeep$very$o$Foo === void 0 ? void 0 : _classPrivateFieldLooseBase(_fnDeep$very$o$Foo, _m)[_m](); | ||
})()) { | ||
return r; | ||
} | ||
|
||
function i(fn, r = (() => { | ||
var _getSelf; | ||
|
||
return (_getSelf = (() => fn === null || fn === void 0 ? void 0 : _classPrivateFieldLooseBase(fn().Foo, _self)[_self])()?.getSelf()) === null || _getSelf === void 0 ? void 0 : _classPrivateFieldLooseBase(_getSelf.self, _m)[_m](); | ||
})()) { | ||
return r; | ||
} | ||
|
||
function j(fn, r = (() => _classPrivateFieldLooseBase(_classPrivateFieldLooseBase(fn().Foo, _self)[_self].getSelf().self, _m)[_m]?.())()) { | ||
return r; | ||
} | ||
|
||
f(o); | ||
g(o); | ||
h(fnDeep); | ||
i(fn); | ||
j(fn); | ||
} | ||
|
||
} | ||
|
||
Object.defineProperty(Foo, _x, { | ||
writable: true, | ||
value: 1 | ||
}); | ||
Object.defineProperty(Foo, _m, { | ||
writable: true, | ||
value: function () { | ||
return _classPrivateFieldLooseBase(this, _x)[_x]; | ||
} | ||
}); | ||
Object.defineProperty(Foo, _self, { | ||
writable: true, | ||
value: Foo | ||
}); | ||
Foo.self = Foo; | ||
Foo.test(); |
Oops, something went wrong.