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

@ -445,10 +445,13 @@ helpers.objectWithoutProperties = template(`
helpers.possibleConstructorReturn = template(` helpers.possibleConstructorReturn = template(`
(function (self, call) { (function (self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
if (!self) { if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
} }
return call && (typeof call === "object" || typeof call === "function") ? call : self; return self;
}); });
`); `);

View File

@ -2,10 +2,10 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar); babelHelpers.inherits(Foo, _Bar);
function Foo(...args) { function Foo(...args) {
var _temp, _this, _ret; var _temp, _this;
babelHelpers.classCallCheck(this, Foo); 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; return Foo;

View File

@ -4,9 +4,10 @@ var Child = function (_Parent) {
babelHelpers.inherits(Child, _Parent); babelHelpers.inherits(Child, _Parent);
function Child() { 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.scopedFunctionWithThis = function () {
_this.name = {}; _this.name = {};

View File

@ -5,7 +5,7 @@ var Foo = function (_Bar) {
var _temp, _this; var _temp, _this;
babelHelpers.classCallCheck(this, Foo); 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; return _this;
} }

View File

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

View File

@ -2,14 +2,14 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar); babelHelpers.inherits(Foo, _Bar);
function Foo(...args) { function Foo(...args) {
var _temp, _this, _ret; var _temp, _this;
babelHelpers.classCallCheck(this, Foo); 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, enumerable: true,
writable: true, writable: true,
value: "foo" value: "foo"
}), _temp), babelHelpers.possibleConstructorReturn(_this, _ret); }), _temp));
} }
return Foo; return Foo;

View File

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

View File

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

View File

@ -5,7 +5,7 @@ var Foo = function (_Bar) {
var _temp, _this; var _temp, _this;
babelHelpers.classCallCheck(this, Foo); 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, enumerable: true,
writable: true, writable: true,
value: "foo" value: "foo"

View File

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

View File

@ -93,11 +93,11 @@ export default class ClassTransformer {
this.staticPropBody = []; this.staticPropBody = [];
this.body = []; this.body = [];
this.bareSuperAfter = [];
this.bareSupers = []; this.bareSupers = [];
this.pushedConstructor = false; this.pushedConstructor = false;
this.pushedInherits = false; this.pushedInherits = false;
this.pushedThis = false;
this.isLoose = false; this.isLoose = false;
this.superThises = []; this.superThises = [];
@ -431,8 +431,6 @@ export default class ClassTransformer {
); );
} }
const bareSuperAfter = this.bareSuperAfter.map(fn => fn(thisRef));
if ( if (
bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.isExpressionStatement() &&
bareSuper.parentPath.container === body.node.body && bareSuper.parentPath.container === body.node.body &&
@ -441,22 +439,18 @@ export default class ClassTransformer {
// this super call is the last statement in the body so we can just straight up // this super call is the last statement in the body so we can just straight up
// turn it into a return // turn it into a return
if (this.superThises.length || bareSuperAfter.length) { if (this.superThises.length) {
bareSuper.scope.push({ id: thisRef }); bareSuper.scope.push({ id: thisRef });
call = t.assignmentExpression("=", thisRef, call); call = t.assignmentExpression("=", thisRef, call);
} }
if (bareSuperAfter.length) {
call = t.toSequenceExpression([call, ...bareSuperAfter, thisRef]);
}
bareSuper.parentPath.replaceWith(t.returnStatement(call)); bareSuper.parentPath.replaceWith(t.returnStatement(call));
} else { } else {
bareSuper.replaceWithMultiple([ if (!this.pushedThis) {
t.variableDeclaration("var", [t.variableDeclarator(thisRef, call)]), body.scope.push({ id: thisRef });
...bareSuperAfter, this.pushedThis = true;
t.expressionStatement(thisRef), }
]); bareSuper.replaceWith(t.assignmentExpression("=", thisRef, call));
} }
} }
@ -522,17 +516,9 @@ export default class ClassTransformer {
} }
for (const returnPath of this.superReturns) { for (const returnPath of this.superReturns) {
if (returnPath.node.argument) { returnPath
const ref = returnPath.scope.generateDeclaredUidIdentifier("ret"); .get("argument")
returnPath .replaceWith(wrapReturn(returnPath.node.argument));
.get("argument")
.replaceWithMultiple([
t.assignmentExpression("=", ref, returnPath.node.argument),
wrapReturn(ref),
]);
} else {
returnPath.get("argument").replaceWith(wrapReturn());
}
} }
} }

View File

@ -6,12 +6,9 @@ let A = function (_B) {
_inheritsLoose(A, _B); _inheritsLoose(A, _B);
function A(track) { function A(track) {
if (track !== undefined) { var _this;
var _this = _B.call(this, track) || this;
} else {
var _this = _B.call(this) || this;
}
if (track !== undefined) _this = _B.call(this, track) || this;else _this = _B.call(this) || this;
return _this; return _this;
} }

View File

@ -4,15 +4,15 @@ var Test = function (_Foo) {
function Test() { function Test() {
var _Foo$prototype$test, _Foo$prototype$test2; var _Foo$prototype$test, _Foo$prototype$test2;
woops.super.test(); var _this;
var _this = _Foo.call(this) || this; woops.super.test();
_this = _Foo.call(this) || this;
_Foo.prototype.test.call(_this); _Foo.prototype.test.call(_this);
var _this = _Foo.apply(this, arguments) || this; _this = _Foo.apply(this, arguments) || this;
_this = _Foo.call.apply(_Foo, [this, "test"].concat(Array.prototype.slice.call(arguments))) || this;
var _this = _Foo.call.apply(_Foo, [this, "test"].concat(Array.prototype.slice.call(arguments))) || this;
(_Foo$prototype$test = _Foo.prototype.test).call.apply(_Foo$prototype$test, [_this].concat(Array.prototype.slice.call(arguments))); (_Foo$prototype$test = _Foo.prototype.test).call.apply(_Foo$prototype$test, [_this].concat(Array.prototype.slice.call(arguments)));

View File

@ -2,8 +2,9 @@ var Test = function (_Foo) {
babelHelpers.inheritsLoose(Test, _Foo); babelHelpers.inheritsLoose(Test, _Foo);
function Test() { function Test() {
var _this = _Foo.call(this) || this; var _this;
_this = _Foo.call(this) || this;
_Foo.prototype.test; _Foo.prototype.test;
_Foo.prototype.test.whatever; _Foo.prototype.test.whatever;
return _this; return _this;

View File

@ -2,7 +2,9 @@ var Test = function (_Foo) {
babelHelpers.inheritsLoose(Test, _Foo); babelHelpers.inheritsLoose(Test, _Foo);
function Test() { function Test() {
var _this = _Foo.call(this) || this; var _this;
_this = _Foo.call(this) || this;
_Foo.prototype.test.whatever(); _Foo.prototype.test.whatever();

View File

@ -0,0 +1,44 @@
"use strict";
class Foo {
constructor() {
return { x: 1 };
}
}
assert.equal(new Foo().x, 1);
class Bar extends Foo {
constructor() {
super();
return;
}
}
assert.equal(new Bar().x, 1);
class Bar2 extends Foo {
constructor() {
super();
assert.equal(this.x, 1);
return { x: 2 };
}
}
assert.equal(new Bar2().x, 2);
let singleton;
class Sub extends Foo {
constructor() {
if (singleton) {
return singleton;
}
singleton = super();
}
}
let instance = new Sub;
assert.equal(instance, singleton);
instance = new Sub;
assert.equal(instance, singleton);

View File

@ -20,10 +20,10 @@ var Connection = function (_EventEmitter) {
babelHelpers.inherits(Connection, _EventEmitter); babelHelpers.inherits(Connection, _EventEmitter);
function Connection(endpoint, joinKey, joinData, roomId) { function Connection(endpoint, joinKey, joinData, roomId) {
var _this;
babelHelpers.classCallCheck(this, Connection); babelHelpers.classCallCheck(this, Connection);
_this = babelHelpers.possibleConstructorReturn(this, (Connection.__proto__ || Object.getPrototypeOf(Connection)).call(this));
var _this = babelHelpers.possibleConstructorReturn(this, (Connection.__proto__ || Object.getPrototypeOf(Connection)).call(this));
_this.isConnected = false; _this.isConnected = false;
_this.roomId = roomId; // ... _this.roomId = roomId; // ...

View File

@ -12,9 +12,10 @@ var a1 = function (_b) {
babelHelpers.inherits(a1, _b); babelHelpers.inherits(a1, _b);
function a1() { function a1() {
babelHelpers.classCallCheck(this, a1); var _this;
var _this = babelHelpers.possibleConstructorReturn(this, (a1.__proto__ || Object.getPrototypeOf(a1)).call(this)); babelHelpers.classCallCheck(this, a1);
_this = babelHelpers.possibleConstructorReturn(this, (a1.__proto__ || Object.getPrototypeOf(a1)).call(this));
_this.x = function () { _this.x = function () {
return _this; return _this;
@ -30,9 +31,10 @@ var a2 = function (_b2) {
babelHelpers.inherits(a2, _b2); babelHelpers.inherits(a2, _b2);
function a2() { function a2() {
babelHelpers.classCallCheck(this, a2); var _this2;
var _this2 = babelHelpers.possibleConstructorReturn(this, (a2.__proto__ || Object.getPrototypeOf(a2)).call(this)); babelHelpers.classCallCheck(this, a2);
_this2 = babelHelpers.possibleConstructorReturn(this, (a2.__proto__ || Object.getPrototypeOf(a2)).call(this));
_this2.x = function () { _this2.x = function () {
return _this2; return _this2;

View File

@ -8,10 +8,10 @@ var B = function (_A) {
babelHelpers.inherits(B, _A); babelHelpers.inherits(B, _A);
function B() { function B() {
var _this, _ret; var _this;
babelHelpers.classCallCheck(this, B); babelHelpers.classCallCheck(this, B);
return _ret = (_this = babelHelpers.possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this)), _this), babelHelpers.possibleConstructorReturn(_this, _ret); return babelHelpers.possibleConstructorReturn(_this, _this = babelHelpers.possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this)));
} }
return B; return B;

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
@ -14,14 +14,11 @@ var A = function (_B) {
_inherits(A, _B); _inherits(A, _B);
function A(track) { function A(track) {
var _this;
_classCallCheck(this, A); _classCallCheck(this, A);
if (track !== undefined) { if (track !== undefined) _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this, track));else _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this));
var _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this, track));
} else {
var _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this));
}
return _possibleConstructorReturn(_this); return _possibleConstructorReturn(_this);
} }

View File

@ -4,17 +4,14 @@ var Test = function (_Foo) {
function Test() { function Test() {
var _ref, _babelHelpers$get; var _ref, _babelHelpers$get;
var _this;
babelHelpers.classCallCheck(this, Test); babelHelpers.classCallCheck(this, Test);
woops.super.test(); woops.super.test();
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
var _this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).call(_this); babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).call(_this);
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).apply(this, arguments));
var _this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).apply(this, arguments)); _this = babelHelpers.possibleConstructorReturn(this, (_ref = Test.__proto__ || Object.getPrototypeOf(Test)).call.apply(_ref, [this, "test"].concat(Array.prototype.slice.call(arguments))));
var _this = babelHelpers.possibleConstructorReturn(this, (_ref = Test.__proto__ || Object.getPrototypeOf(Test)).call.apply(_ref, [this, "test"].concat(Array.prototype.slice.call(arguments))));
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).apply(_this, arguments); babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).apply(_this, arguments);
(_babelHelpers$get = babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this)).call.apply(_babelHelpers$get, [_this, "test"].concat(Array.prototype.slice.call(arguments))); (_babelHelpers$get = babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this)).call.apply(_babelHelpers$get, [_this, "test"].concat(Array.prototype.slice.call(arguments)));

View File

@ -2,10 +2,10 @@ var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo); babelHelpers.inherits(Test, _Foo);
function Test() { function Test() {
var _this;
babelHelpers.classCallCheck(this, Test); babelHelpers.classCallCheck(this, Test);
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
var _this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this); babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this);
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).whatever; babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).whatever;
return _this; return _this;

View File

@ -2,10 +2,10 @@ var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo); babelHelpers.inherits(Test, _Foo);
function Test() { function Test() {
var _this;
babelHelpers.classCallCheck(this, Test); babelHelpers.classCallCheck(this, Test);
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
var _this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).whatever(); babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).whatever();
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).call(_this); babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", _this).call(_this);
return _this; return _this;

View File

@ -7,10 +7,10 @@ var Foo = function (_Bar) {
babelHelpers.inherits(Foo, _Bar); babelHelpers.inherits(Foo, _Bar);
function Foo() { function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo); babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
var _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
_this.state = "test"; _this.state = "test";
return _this; return _this;
} }

View File

@ -1,3 +1,4 @@
"use strict";
class Foo { class Foo {
constructor() { constructor() {
return { x: 1 }; return { x: 1 };
@ -24,3 +25,34 @@ class Bar2 extends Foo {
} }
assert.equal(new Bar2().x, 2); assert.equal(new Bar2().x, 2);
let singleton;
class Sub extends Foo {
constructor() {
if (singleton) {
return singleton;
}
singleton = super();
}
}
let instance = new Sub;
assert.equal(instance, singleton);
instance = new Sub;
assert.equal(instance, singleton);
class Null extends Foo {
constructor() {
if (false) {
super();
}
return null;
super();
}
}
assert.throws(() => {
new Null();
}, "this");

View File

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