Justin Ridgewell f8ab9466d3
Move subclass inheritance to end (#7772)
We were using `Object.create` to setup the prototype chain at the start of the class definition, which lead to #7771.

I was a bit worried about a speed hit, but it seems everyone optimizes the two patterns the same way.
https://jsbench.github.io/#f9fca52407643d96458a35763b201215

Fixes #7771.
2018-04-21 17:31:44 -04:00

47 lines
902 B
JavaScript

"use strict";
var Hello = function Hello() {
babelHelpers.classCallCheck(this, Hello);
return {
toString() {
return 'hello';
}
};
};
var Outer =
/*#__PURE__*/
function (_Hello) {
function Outer() {
var _this2 = this;
var _this;
babelHelpers.classCallCheck(this, Outer);
var Inner =
/*#__PURE__*/
function () {
function Inner() {
babelHelpers.classCallCheck(this, Inner);
}
babelHelpers.createClass(Inner, [{
key: _this = babelHelpers.possibleConstructorReturn(_this2, babelHelpers.getPrototypeOf(Outer).call(_this2)),
value: function value() {
return 'hello';
}
}]);
return Inner;
}();
return babelHelpers.possibleConstructorReturn(_this, new Inner());
}
babelHelpers.inherits(Outer, _Hello);
return Outer;
}(Hello);
expect(new Outer().hello()).toBe('hello');