Super property eval order (#11480)

This commit is contained in:
Justin Ridgewell
2020-04-25 12:34:07 -04:00
committed by GitHub
parent 2e4f18ac92
commit 0bbf2da568
19 changed files with 93 additions and 63 deletions

View File

@@ -26,15 +26,15 @@ var ColorPoint = /*#__PURE__*/function (_Point) {
var _super = _createSuper(ColorPoint);
function ColorPoint() {
var _this;
var _thisSuper, _thisSuper2, _this;
babelHelpers.classCallCheck(this, ColorPoint);
_this = _super.call(this);
_this.x = 2;
babelHelpers.set(babelHelpers.getPrototypeOf(ColorPoint.prototype), "x", 3, babelHelpers.assertThisInitialized(_this), true);
babelHelpers.set((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(ColorPoint.prototype)), "x", 3, _thisSuper, true);
expect(_this.x).toBe(3); // A
expect(babelHelpers.get(babelHelpers.getPrototypeOf(ColorPoint.prototype), "x", babelHelpers.assertThisInitialized(_this))).toBeUndefined(); // B
expect(babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(ColorPoint.prototype)), "x", _thisSuper2)).toBeUndefined(); // B
return _this;
}

View File

@@ -8,17 +8,17 @@ var Test = /*#__PURE__*/function (_Foo) {
function Test() {
var _babelHelpers$get;
var _this;
var _thisSuper, _thisSuper2, _thisSuper3, _this;
babelHelpers.classCallCheck(this, Test);
woops.super.test();
_this = _super.call(this);
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper).call(_thisSuper);
_this = _super.apply(this, arguments);
_this = _super.call.apply(_super, [this, "test"].concat(Array.prototype.slice.call(arguments)));
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).apply(babelHelpers.assertThisInitialized(_this), arguments);
babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper2).apply(_thisSuper2, arguments);
(_babelHelpers$get = babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this))).call.apply(_babelHelpers$get, [babelHelpers.assertThisInitialized(_this), "test"].concat(Array.prototype.slice.call(arguments)));
(_babelHelpers$get = babelHelpers.get((_thisSuper3 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper3)).call.apply(_babelHelpers$get, [_thisSuper3, "test"].concat(Array.prototype.slice.call(arguments)));
return _this;
}

View File

@@ -6,12 +6,12 @@ var Test = /*#__PURE__*/function (_Foo) {
var _super = babelHelpers.createSuper(Test);
function Test() {
var _this;
var _thisSuper, _thisSuper2, _this;
babelHelpers.classCallCheck(this, Test);
_this = _super.call(this);
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this));
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).whatever;
babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper);
babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper2).whatever;
return _this;
}

View File

@@ -6,12 +6,12 @@ var Test = /*#__PURE__*/function (_Foo) {
var _super = babelHelpers.createSuper(Test);
function Test() {
var _this;
var _thisSuper, _thisSuper2, _this;
babelHelpers.classCallCheck(this, Test);
_this = _super.call(this);
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).whatever();
babelHelpers.get(babelHelpers.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper).whatever();
babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "test", _thisSuper2).call(_thisSuper2);
return _this;
}

View File

@@ -20,7 +20,7 @@ var Outer = /*#__PURE__*/function (_Hello) {
var _super = babelHelpers.createSuper(Outer);
function Outer() {
var _this;
var _thisSuper, _this;
babelHelpers.classCallCheck(this, Outer);
_this = _super.call(this);
@@ -31,7 +31,7 @@ var Outer = /*#__PURE__*/function (_Hello) {
}
babelHelpers.createClass(Inner, [{
key: babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)),
key: babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper),
value: function value() {
return 'hello';
}

View File

@@ -20,12 +20,12 @@ var Outer = /*#__PURE__*/function (_Hello) {
var _super = babelHelpers.createSuper(Outer);
function Outer() {
var _this;
var _thisSuper, _this;
babelHelpers.classCallCheck(this, Outer);
_this = _super.call(this);
var Inner = {
[babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this))]() {
[babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper)]() {
return 'hello';
}

View File

@@ -26,11 +26,11 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = _createSuper(Foo);
function Foo() {
var _this;
var _thisSuper, _this;
_classCallCheck(this, Foo);
_get(_getPrototypeOf(Foo.prototype), "foo", _assertThisInitialized(_this)).call(_assertThisInitialized(_this), _this = _super.call(this));
_get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Foo.prototype)), "foo", _thisSuper).call(_thisSuper, _this = _super.call(this));
return _this;
}

View File

@@ -26,11 +26,11 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = _createSuper(Foo);
function Foo() {
var _this;
var _thisSuper, _this;
_classCallCheck(this, Foo);
_get(_getPrototypeOf(Foo.prototype), "foo", _assertThisInitialized(_this)).call(_assertThisInitialized(_this));
_get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Foo.prototype)), "foo", _thisSuper).call(_thisSuper);
return _this = _super.call(this);
}

View File

@@ -6,13 +6,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
var _thisSuper, _thisSuper2, _this;
babelHelpers.classCallCheck(this, Foo);
var t = () => babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
var t = () => babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "test", _thisSuper).call(_thisSuper);
babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "foo", _thisSuper2).call(_thisSuper2);
return _this = _super.call(this);
}

View File

@@ -6,11 +6,11 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
var _thisSuper, _this;
babelHelpers.classCallCheck(this, Foo);
var t = () => babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
var t = () => babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "test", _thisSuper).call(_thisSuper);
_this = _super.call(this);
t();

View File

@@ -6,11 +6,11 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
var _thisSuper, _this;
babelHelpers.classCallCheck(this, Foo);
var t = () => babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
var t = () => babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), "test", _thisSuper).call(_thisSuper);
return _this = _super.call(this);
}

View File

@@ -1,20 +1,18 @@
let called = false;
class A {
method() {
get prop() {
called = true;
}
get methodName() {
return "method";
}
}
class B extends A {
constructor() {
super[super().methodName]()
super[super().prop]
}
}
new B();
expect(called).toBe(true);
expect(() => {
new B();
}).toThrow();
expect(called).toBe(false);

View File

@@ -6,10 +6,10 @@ var Foo = /*#__PURE__*/function (_Bar) {
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
var _thisSuper, _this;
babelHelpers.classCallCheck(this, Foo);
babelHelpers.get(babelHelpers.getPrototypeOf(Foo.prototype), (_this = _super.call(this)).method, babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Foo.prototype)), (_this = _super.call(this)).method, _thisSuper).call(_thisSuper);
return _this;
}