Felipe Armoni fdfe97879e
Disallow reinitializing private elements (#13601)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2021-08-30 12:44:38 +02:00

29 lines
549 B
JavaScript

class Base {
superMethod() {
return 'good';
}
}
var _privateMethod = /*#__PURE__*/new WeakSet();
class Sub extends Base {
constructor(...args) {
super(...args);
babelHelpers.classPrivateMethodInitSpec(this, _privateMethod);
}
superMethod() {
return 'bad';
}
publicMethod() {
return babelHelpers.classPrivateMethodGet(this, _privateMethod, _privateMethod2).call(this);
}
}
function _privateMethod2() {
return babelHelpers.get(babelHelpers.getPrototypeOf(Sub.prototype), "superMethod", this).call(this);
}