-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
1 parent
0acfeb8
commit 3970e03
Showing
66 changed files
with
620 additions
and
812 deletions.
There are no files selected for viewing
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
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
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
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
22 changes: 8 additions & 14 deletions
22
...m-class-properties-babel/test/fixtures/private/1-helpermemberexpressionfunction/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 |
---|---|---|
@@ -1,42 +1,36 @@ | ||
function _toSetter(t, e, n) { e || (e = []); var r = e.length++; return Object.defineProperty({}, "_", { set: function (o) { e[r] = o, t.apply(n, e); } }); } | ||
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; } | ||
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); } | ||
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } | ||
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); } | ||
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } | ||
var _arr = /*#__PURE__*/new WeakMap(); | ||
class D { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _arr, void 0); | ||
babelHelpers.classPrivateFieldInitSpec(this, _arr, void 0); | ||
} | ||
f() { | ||
for (const el of _classPrivateFieldGet(_arr, this)); | ||
for (const el of babelHelpers.classPrivateFieldGet2(_arr, this)); | ||
} | ||
} | ||
var _p = /*#__PURE__*/new WeakMap(); | ||
class C { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _p, void 0); | ||
babelHelpers.classPrivateFieldInitSpec(this, _p, void 0); | ||
} | ||
m() { | ||
for (_toSetter(_classPrivateFieldSet, [_p, this])._ of []); | ||
for (babelHelpers.toSetter(babelHelpers.classPrivateFieldSet2, [_p, this])._ of []); | ||
} | ||
} | ||
var _arr2 = /*#__PURE__*/new WeakMap(); | ||
class E { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _arr2, void 0); | ||
babelHelpers.classPrivateFieldInitSpec(this, _arr2, void 0); | ||
} | ||
f() { | ||
for (_toSetter(_classPrivateFieldSet, [_arr2, this])._ of [1, 2]); | ||
for (babelHelpers.toSetter(babelHelpers.classPrivateFieldSet2, [_arr2, this])._ of [1, 2]); | ||
} | ||
} | ||
var _ar = /*#__PURE__*/new WeakMap(); | ||
class F { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _ar, void 0); | ||
babelHelpers.classPrivateFieldInitSpec(this, _ar, void 0); | ||
} | ||
g() { | ||
for (_toSetter(_classPrivateFieldSet, [_ar, this])._ in [1, 2, 3]); | ||
for (babelHelpers.toSetter(babelHelpers.classPrivateFieldSet2, [_ar, this])._ in [1, 2, 3]); | ||
} | ||
} |
15 changes: 5 additions & 10 deletions
15
.../babel-plugin-transform-class-properties-babel/test/fixtures/private/assignment/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 |
---|---|---|
@@ -1,18 +1,13 @@ | ||
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); } | ||
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } | ||
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; } | ||
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); } | ||
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } | ||
var _foo = /*#__PURE__*/new WeakMap(); | ||
class Foo { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _foo, 0); | ||
babelHelpers.classPrivateFieldInitSpec(this, _foo, 0); | ||
} | ||
test(other) { | ||
var _other$obj; | ||
_classPrivateFieldSet(_foo, this, _classPrivateFieldGet(_foo, this) + 1); | ||
_classPrivateFieldSet(_foo, this, 2); | ||
_classPrivateFieldSet(_foo, _other$obj = other.obj, _classPrivateFieldGet(_foo, _other$obj) + 1); | ||
_classPrivateFieldSet(_foo, other.obj, 2); | ||
babelHelpers.classPrivateFieldSet2(_foo, this, babelHelpers.classPrivateFieldGet2(_foo, this) + 1); | ||
babelHelpers.classPrivateFieldSet2(_foo, this, 2); | ||
babelHelpers.classPrivateFieldSet2(_foo, _other$obj = other.obj, babelHelpers.classPrivateFieldGet2(_foo, _other$obj) + 1); | ||
babelHelpers.classPrivateFieldSet2(_foo, other.obj, 2); | ||
} | ||
} |
10 changes: 3 additions & 7 deletions
10
.../tests/babel-plugin-transform-class-properties-babel/test/fixtures/private/call/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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); } | ||
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } | ||
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); } | ||
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } | ||
var _foo = /*#__PURE__*/new WeakMap(); | ||
class Foo { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _foo, function () { | ||
babelHelpers.classPrivateFieldInitSpec(this, _foo, function () { | ||
return this; | ||
}); | ||
} | ||
test(other) { | ||
var _other$obj; | ||
_classPrivateFieldGet(_foo, this).call(this); | ||
_classPrivateFieldGet(_foo, _other$obj = other.obj).call(_other$obj); | ||
babelHelpers.classPrivateFieldGet2(_foo, this).call(this); | ||
babelHelpers.classPrivateFieldGet2(_foo, _other$obj = other.obj).call(_other$obj); | ||
} | ||
} |
25 changes: 10 additions & 15 deletions
25
...s/babel-plugin-transform-class-properties-babel/test/fixtures/private/canonical/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 |
---|---|---|
@@ -1,33 +1,28 @@ | ||
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); } | ||
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } | ||
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); } | ||
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; } | ||
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } | ||
var _x = /*#__PURE__*/new WeakMap(); | ||
var _y = /*#__PURE__*/new WeakMap(); | ||
class Point { | ||
constructor(x = 0, y = 0) { | ||
_classPrivateFieldInitSpec(this, _x, void 0); | ||
_classPrivateFieldInitSpec(this, _y, void 0); | ||
_classPrivateFieldSet(_x, this, +x); | ||
_classPrivateFieldSet(_y, this, +y); | ||
babelHelpers.classPrivateFieldInitSpec(this, _x, void 0); | ||
babelHelpers.classPrivateFieldInitSpec(this, _y, void 0); | ||
babelHelpers.classPrivateFieldSet2(_x, this, +x); | ||
babelHelpers.classPrivateFieldSet2(_y, this, +y); | ||
} | ||
get x() { | ||
return _classPrivateFieldGet(_x, this); | ||
return babelHelpers.classPrivateFieldGet2(_x, this); | ||
} | ||
set x(value) { | ||
_classPrivateFieldSet(_x, this, +value); | ||
babelHelpers.classPrivateFieldSet2(_x, this, +value); | ||
} | ||
get y() { | ||
return _classPrivateFieldGet(_y, this); | ||
return babelHelpers.classPrivateFieldGet2(_y, this); | ||
} | ||
set y(value) { | ||
_classPrivateFieldSet(_y, this, +value); | ||
babelHelpers.classPrivateFieldSet2(_y, this, +value); | ||
} | ||
equals(p) { | ||
return _classPrivateFieldGet(_x, this) === _classPrivateFieldGet(_x, p) && _classPrivateFieldGet(_y, this) === _classPrivateFieldGet(_y, p); | ||
return babelHelpers.classPrivateFieldGet2(_x, this) === babelHelpers.classPrivateFieldGet2(_x, p) && babelHelpers.classPrivateFieldGet2(_y, this) === babelHelpers.classPrivateFieldGet2(_y, p); | ||
} | ||
toString() { | ||
return `Point<${_classPrivateFieldGet(_x, this)},${_classPrivateFieldGet(_y, this)}>`; | ||
return `Point<${babelHelpers.classPrivateFieldGet2(_x, this)},${babelHelpers.classPrivateFieldGet2(_y, this)}>`; | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
...in-transform-class-properties-babel/test/fixtures/private/constructor-collision/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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); } | ||
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } | ||
var foo = "bar"; | ||
var _bar = /*#__PURE__*/new WeakMap(); | ||
class Foo { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _bar, foo); | ||
babelHelpers.classPrivateFieldInitSpec(this, _bar, foo); | ||
var _foo = "foo"; | ||
} | ||
} |
Oops, something went wrong.