Fix class inheritance in IE10 (#7969)
* Revert "Move subclass inheritance to end (#7772)"
This reverts commit f8ab9466d3.
* Only use getPrototypeOf if setPrototypeOf is implemented
* Update fixtures
* Helpers updates
* Update fixtures
* Fall back to getPrototypeOf
* Update fixtures
This commit is contained in:
committed by
Henry Zhu
parent
ffe04d9195
commit
2af7a33c4e
@@ -13,6 +13,8 @@ let Hello = function Hello() {
|
||||
let Outer =
|
||||
/*#__PURE__*/
|
||||
function (_Hello) {
|
||||
babelHelpers.inherits(Outer, _Hello);
|
||||
|
||||
function Outer() {
|
||||
var _this;
|
||||
|
||||
@@ -28,7 +30,6 @@ function (_Hello) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, new Inner());
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Outer, _Hello);
|
||||
return Outer;
|
||||
}(Hello);
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ function () {
|
||||
let Outer =
|
||||
/*#__PURE__*/
|
||||
function (_Hello) {
|
||||
babelHelpers.inherits(Outer, _Hello);
|
||||
|
||||
function Outer() {
|
||||
var _this;
|
||||
|
||||
@@ -35,7 +37,6 @@ function (_Hello) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, new Inner());
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Outer, _Hello);
|
||||
return Outer;
|
||||
}(Hello);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -25,7 +27,6 @@ function (_Bar) {
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ var Bar =
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Bar, _Foo);
|
||||
|
||||
function Bar(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -25,7 +27,6 @@ function (_Foo) {
|
||||
}), _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Bar, _Foo);
|
||||
return Bar;
|
||||
}(Foo);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Child =
|
||||
function (_Parent) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
@@ -17,7 +19,6 @@ function (_Parent) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
return Child;
|
||||
}(Parent);
|
||||
|
||||
|
||||
@@ -10,12 +10,13 @@ var Outer = function Outer() {
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_babelHelpers$classPr) {
|
||||
babelHelpers.inherits(Test, _babelHelpers$classPr);
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Test, _babelHelpers$classPr);
|
||||
return Test;
|
||||
}(babelHelpers.classPrivateFieldLooseBase(this, _outer)[_outer]);
|
||||
};
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -14,7 +16,6 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -15,7 +17,6 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -21,7 +23,6 @@ function (_Bar) {
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ var Bar =
|
||||
function (_Foo) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Bar, _Foo);
|
||||
|
||||
function Bar(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -20,7 +22,6 @@ function (_Foo) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Bar).call(this, ...args)), _prop2.set(babelHelpers.assertThisInitialized(babelHelpers.assertThisInitialized(_this)), "bar"), _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Bar, _Foo);
|
||||
return Bar;
|
||||
}(Foo);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Child =
|
||||
function (_Parent) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
@@ -16,7 +18,6 @@ function (_Parent) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
return Child;
|
||||
}(Parent);
|
||||
|
||||
|
||||
@@ -8,12 +8,13 @@ var Outer = function Outer() {
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_babelHelpers$classPr) {
|
||||
babelHelpers.inherits(Test, _babelHelpers$classPr);
|
||||
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Test, _babelHelpers$classPr);
|
||||
return Test;
|
||||
}(babelHelpers.classPrivateFieldGet(this, _outer));
|
||||
};
|
||||
|
||||
@@ -21,6 +21,8 @@ var B =
|
||||
function (_A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -28,7 +30,6 @@ function (_A) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args)), _foo.set(babelHelpers.assertThisInitialized(babelHelpers.assertThisInitialized(_this)), babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this))), _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
return B;
|
||||
}(A);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -11,7 +13,6 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -14,7 +16,6 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -10,6 +12,5 @@ function (_Bar) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, ...args)), _this.bar = "foo", _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Child =
|
||||
function (_Parent) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
@@ -16,6 +18,5 @@ function (_Parent) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
return Child;
|
||||
}(Parent);
|
||||
|
||||
@@ -6,12 +6,13 @@ function withContext(ComposedComponent) {
|
||||
function (_Component) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
babelHelpers.classCallCheck(this, WithContext);
|
||||
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
return WithContext;
|
||||
}(Component), _class.propTypes = {
|
||||
context: PropTypes.shape({
|
||||
|
||||
@@ -21,6 +21,8 @@ var B =
|
||||
function (_A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -28,6 +30,5 @@ function (_A) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args)), _this.foo = babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)), _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
return B;
|
||||
}(A);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -11,6 +13,5 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -12,6 +14,5 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -19,6 +21,5 @@ function (_Bar) {
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -10,6 +12,5 @@ function (_Bar) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, ...args)), babelHelpers.defineProperty(babelHelpers.assertThisInitialized(babelHelpers.assertThisInitialized(_this)), "bar", "foo"), _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Child =
|
||||
function (_Parent) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
@@ -14,6 +16,5 @@ function (_Parent) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Child, _Parent);
|
||||
return Child;
|
||||
}(Parent);
|
||||
|
||||
@@ -6,12 +6,13 @@ function withContext(ComposedComponent) {
|
||||
function (_Component) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
babelHelpers.classCallCheck(this, WithContext);
|
||||
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
return WithContext;
|
||||
}(Component), babelHelpers.defineProperty(_class, "propTypes", {
|
||||
context: PropTypes.shape({
|
||||
|
||||
@@ -21,6 +21,8 @@ var B =
|
||||
function (_A) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B(...args) {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -28,6 +30,5 @@ function (_A) {
|
||||
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args)), babelHelpers.defineProperty(babelHelpers.assertThisInitialized(babelHelpers.assertThisInitialized(_this)), "foo", babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this))), _temp));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(B, _A);
|
||||
return B;
|
||||
}(A);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _temp, _this;
|
||||
|
||||
@@ -11,6 +13,5 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -3,6 +3,8 @@ var Foo =
|
||||
function (_Bar) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
@@ -12,6 +14,5 @@ function (_Bar) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
@@ -2,12 +2,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
||||
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
@@ -18,7 +18,7 @@ function _get(target, property, receiver) { if (typeof Reflect !== "undefined" &
|
||||
|
||||
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var Test = function Test() {
|
||||
"use strict";
|
||||
@@ -30,6 +30,8 @@ var Test = function Test() {
|
||||
var Other =
|
||||
/*#__PURE__*/
|
||||
function (_Test) {
|
||||
_inherits(Other, _Test);
|
||||
|
||||
function Other() {
|
||||
var _getPrototypeOf2;
|
||||
|
||||
@@ -46,8 +48,6 @@ var Test = function Test() {
|
||||
}), _temp));
|
||||
}
|
||||
|
||||
_inherits(Other, _Test);
|
||||
|
||||
return Other;
|
||||
}(Test);
|
||||
|
||||
|
||||
@@ -6,12 +6,13 @@ function withContext(ComposedComponent) {
|
||||
function (_Component) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
babelHelpers.classCallCheck(this, WithContext);
|
||||
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
return WithContext;
|
||||
}(Component), _class.propTypes = {
|
||||
context: PropTypes.shape({
|
||||
|
||||
Reference in New Issue
Block a user