Justin Ridgewell 0a257e8972
Move more class state out of replaceSupers (#7750)
Yes, the output is uglier. But, this is necessary for me to refactor
`replaceSupers` for #7733, which is necessary for both #7555 and
https://github.com/babel/babel/pull/7553#issuecomment-381434519.

I'm still in the middle of cleaning up all this code. Don't expect
`transformClass` to survive much longer as it's written currently.
2018-04-21 22:56:14 -04:00

50 lines
1.1 KiB
JavaScript

var Point =
/*#__PURE__*/
function () {
"use strict";
function Point() {
babelHelpers.classCallCheck(this, Point);
}
babelHelpers.createClass(Point, [{
key: "getX",
value: function getX() {
expect(this.x).toBe(3); // C
}
}]);
return Point;
}();
var ColorPoint =
/*#__PURE__*/
function (_Point) {
"use strict";
function ColorPoint() {
var _this;
babelHelpers.classCallCheck(this, ColorPoint);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ColorPoint).call(this));
_this.x = 2;
babelHelpers.set(babelHelpers.getPrototypeOf(ColorPoint.prototype), "x", 3, babelHelpers.assertThisInitialized(_this), true);
expect(_this.x).toBe(3); // A
expect(babelHelpers.get(babelHelpers.getPrototypeOf(ColorPoint.prototype), "x", babelHelpers.assertThisInitialized(_this))).toBeUndefined(); // B
return _this;
}
babelHelpers.createClass(ColorPoint, [{
key: "m",
value: function m() {
this.getX();
}
}]);
babelHelpers.inherits(ColorPoint, _Point);
return ColorPoint;
}(Point);
var cp = new ColorPoint();
cp.m();