Tim McClure 0859535b62 Private class methods stage 3 (#8654)
* Add private method syntax support

* Add private method spec support

* Add private method loose support

* Throw error if static private method is used

* Add more isStatic & isMethod checks

* Remove `writable:false` from private method inits

`writable` is false by default.

* Add private method func obj equality check

* Throw if private accessor is used

* Add check for fields === private method loose mode

* Throw buildCodeFrameErrors instead of Errors

* Move obj destructuring inside for loop

* Remove "computed" from ClassPrivateMethod type def
2018-11-28 16:20:09 -08:00

51 lines
1.1 KiB
JavaScript

var Foo =
/*#__PURE__*/
function () {
"use strict";
function Foo(status) {
babelHelpers.classCallCheck(this, Foo);
_getStatus.add(this);
this.status = status;
}
babelHelpers.createClass(Foo, [{
key: "getCurrentStatus",
value: function getCurrentStatus() {
return babelHelpers.classPrivateMethodGet(this, _getStatus, _getStatus2).call(this);
}
}, {
key: "setCurrentStatus",
value: function setCurrentStatus(newStatus) {
this.status = newStatus;
}
}, {
key: "getFakeStatus",
value: function getFakeStatus(fakeStatus) {
var fakeGetStatus = babelHelpers.classPrivateMethodGet(this, _getStatus, _getStatus2);
return function () {
return fakeGetStatus.call({
status: fakeStatus
});
};
}
}, {
key: "getFakeStatusFunc",
value: function getFakeStatusFunc() {
return {
status: 'fake-status',
getFakeStatus: babelHelpers.classPrivateMethodGet(this, _getStatus, _getStatus2)
};
}
}]);
return Foo;
}();
var _getStatus = new WeakSet();
var _getStatus2 = function _getStatus2() {
return this.status;
};