Justin Ridgewell 27c39c512d
Class private properties (#7842)
* Update member-expression-to-functions

1. Babel using British spellings, so `memoise`
2. Provide a helper `AssignmentMemoiser` class, which will assign the memo'd value with the `n`th access.

* Private properties!

* Fixes

* Tests

* Update helper name

* Fix privates that reference other privates

* Don't extend a builtin

* Rebase
2018-05-18 14:03:23 -04:00

52 lines
1006 B
JavaScript

var _foo, _foo2;
var Base =
/*#__PURE__*/
function () {
function Base() {
babelHelpers.classCallCheck(this, Base);
}
babelHelpers.createClass(Base, null, [{
key: "m",
value: function m() {
return babelHelpers.classPrivateFieldGet(this, _foo);
}
}]);
return Base;
}();
_foo = new WeakMap();
_foo.set(Base, 1);
var Sub1 =
/*#__PURE__*/
function (_Base) {
babelHelpers.inherits(Sub1, _Base);
function Sub1() {
babelHelpers.classCallCheck(this, Sub1);
return babelHelpers.possibleConstructorReturn(this, (Sub1.__proto__ || Object.getPrototypeOf(Sub1)).apply(this, arguments));
}
return Sub1;
}(Base);
_foo2 = new WeakMap();
_foo2.set(Sub1, 2);
var Sub2 =
/*#__PURE__*/
function (_Base2) {
babelHelpers.inherits(Sub2, _Base2);
function Sub2() {
babelHelpers.classCallCheck(this, Sub2);
return babelHelpers.possibleConstructorReturn(this, (Sub2.__proto__ || Object.getPrototypeOf(Sub2)).apply(this, arguments));
}
return Sub2;
}(Base);