Files
80fc33a72a Improve super.x output (#16374)
* clean

* improve

* tests

* fix lint

* old helpers

* add fail test

* fix

* Update packages/babel-helpers/src/helpers/superPropGet.ts

Co-authored-by: Nicolò Ribaudo <[email protected]>

* review

* fix lint

* minVersion

---------

Co-authored-by: Nicolò Ribaudo <[email protected]>
2024-07-23 11:37:07 +08:00

37 lines
936 B
JavaScript

var Point = /*#__PURE__*/function () {
"use strict";
function Point() {
babelHelpers.classCallCheck(this, Point);
}
return babelHelpers.createClass(Point, [{
key: "getX",
value: function getX() {
expect(this.x).toBe(3); // C
}
}]);
}();
var ColorPoint = /*#__PURE__*/function (_Point) {
"use strict";
function ColorPoint() {
var _this;
babelHelpers.classCallCheck(this, ColorPoint);
_this = babelHelpers.callSuper(this, ColorPoint);
_this.x = 2;
babelHelpers.superPropSet((_this, ColorPoint), "x", 3, _this, 1, 1);
expect(_this.x).toBe(3); // A
expect(babelHelpers.superPropGet((_this, ColorPoint), "x", _this, 1)).toBeUndefined(); // B
return _this;
}
babelHelpers.inherits(ColorPoint, _Point);
return babelHelpers.createClass(ColorPoint, [{
key: "m",
value: function m() {
this.getX();
}
}]);
}(Point);
var cp = new ColorPoint();
cp.m();