Fix returning an object in a derived class constructor without super (#5885)

This commit is contained in:
Justin Ridgewell
2017-07-11 17:43:19 -04:00
committed by Henry Zhu
parent 960e1708a1
commit e170e6d760
26 changed files with 165 additions and 103 deletions

View File

@@ -2,11 +2,11 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo(...args) {
var _temp, _this, _ret;
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
return _ret = (_temp = (_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, ...args)), _this), _this.bar = "foo", _temp), babelHelpers.possibleConstructorReturn(_this, _ret);
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, ...args)), _this.bar = "foo", _temp));
}
return Foo;
}(Bar);
}(Bar);

View File

@@ -4,9 +4,10 @@ var Child = function (_Parent) {
babelHelpers.inherits(Child, _Parent);
function Child() {
babelHelpers.classCallCheck(this, Child);
var _this;
var _this = babelHelpers.possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).call(this));
babelHelpers.classCallCheck(this, Child);
_this = babelHelpers.possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).call(this));
_this.scopedFunctionWithThis = function () {
_this.name = {};

View File

@@ -5,7 +5,7 @@ var Foo = function (_Bar) {
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
foo((_temp = (_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this)), _this), _this.bar = "foo", _temp));
foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this)), _this.bar = "foo", _temp));
return _this;
}

View File

@@ -2,13 +2,13 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
var _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
_this.bar = "foo";
return _this;
}
return Foo;
}(Bar);
}(Bar);

View File

@@ -2,15 +2,15 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo(...args) {
var _temp, _this, _ret;
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
return _ret = (_temp = (_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, ...args)), _this), Object.defineProperty(_this, "bar", {
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, ...args)), Object.defineProperty(_this, "bar", {
enumerable: true,
writable: true,
value: "foo"
}), _temp), babelHelpers.possibleConstructorReturn(_this, _ret);
}), _temp));
}
return Foo;
}(Bar);
}(Bar);

View File

@@ -4,10 +4,10 @@ var Child = function (_Parent) {
babelHelpers.inherits(Child, _Parent);
function Child() {
var _this;
babelHelpers.classCallCheck(this, Child);
var _this = babelHelpers.possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).call(this));
_this = babelHelpers.possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).call(this));
Object.defineProperty(_this, "scopedFunctionWithThis", {
enumerable: true,
writable: true,

View File

@@ -16,14 +16,14 @@ var B = function (_A) {
babelHelpers.inherits(B, _A);
function B(...args) {
var _temp, _this, _ret;
var _temp, _this;
babelHelpers.classCallCheck(this, B);
return _ret = (_temp = (_this = babelHelpers.possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this, ...args)), _this), Object.defineProperty(_this, "foo", {
return babelHelpers.possibleConstructorReturn(_this, (_temp = _this = babelHelpers.possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this, ...args)), Object.defineProperty(_this, "foo", {
enumerable: true,
writable: true,
value: babelHelpers.get(B.prototype.__proto__ || Object.getPrototypeOf(B.prototype), "foo", _this).call(_this)
}), _temp), babelHelpers.possibleConstructorReturn(_this, _ret);
}), _temp));
}
return B;

View File

@@ -5,7 +5,7 @@ var Foo = function (_Bar) {
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
foo((_temp = (_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this)), _this), Object.defineProperty(_this, "bar", {
foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this)), Object.defineProperty(_this, "bar", {
enumerable: true,
writable: true,
value: "foo"

View File

@@ -2,10 +2,10 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
var _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
Object.defineProperty(_this, "bar", {
enumerable: true,
writable: true,
@@ -15,4 +15,4 @@ var Foo = function (_Bar) {
}
return Foo;
}(Bar);
}(Bar);