inline back the super constructor call helper - fixes #684
This commit is contained in:
parent
86fbba08d8
commit
8d81a382f7
@ -1,5 +1,3 @@
|
|||||||
(function (instance, Constructor) {
|
if (Object.getPrototypeOf(CLASS_NAME) !== null) {
|
||||||
if (Object.getPrototypeOf(Constructor) !== null) {
|
Object.getPrototypeOf(CLASS_NAME).apply(instance, arguments);
|
||||||
Object.getPrototypeOf(Constructor).apply(instance, arguments);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|||||||
@ -169,19 +169,11 @@ Class.prototype.buildBody = function () {
|
|||||||
// we have no constructor, we have a super, and the super doesn't appear to be falsy
|
// we have no constructor, we have a super, and the super doesn't appear to be falsy
|
||||||
if (!this.hasConstructor && superName && !t.isFalsyExpression(superName)) {
|
if (!this.hasConstructor && superName && !t.isFalsyExpression(superName)) {
|
||||||
var helperName = "class-super-constructor-call";
|
var helperName = "class-super-constructor-call";
|
||||||
|
if (this.isLoose) helperName += "-loose"
|
||||||
if (this.isLoose) {
|
constructor.body.body.push(util.template(helperName, {
|
||||||
constructor.body.body.push(util.template(helperName + "-loose", {
|
|
||||||
CLASS_NAME: className,
|
CLASS_NAME: className,
|
||||||
SUPER_NAME: this.superName
|
SUPER_NAME: this.superName
|
||||||
}, true));
|
}, true));
|
||||||
} else {
|
|
||||||
constructor.body.body.push(
|
|
||||||
t.expressionStatement(
|
|
||||||
t.callExpression(this.file.addHelper(helperName), [t.thisExpression(), className])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var instanceProps;
|
var instanceProps;
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var _classSuperConstructorCall = function (instance, Constructor) { if (Object.getPrototypeOf(Constructor) !== null) { Object.getPrototypeOf(Constructor).apply(instance, arguments); } };
|
|
||||||
|
|
||||||
var _inherits = function (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) subClass.__proto__ = superClass; };
|
var _inherits = function (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) subClass.__proto__ = superClass; };
|
||||||
|
|
||||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||||
@ -10,7 +8,9 @@ var BaseController = (function (_Chaplin$Controller) {
|
|||||||
function BaseController() {
|
function BaseController() {
|
||||||
_classCallCheck(this, BaseController);
|
_classCallCheck(this, BaseController);
|
||||||
|
|
||||||
_classSuperConstructorCall(this, BaseController);
|
if (Object.getPrototypeOf(BaseController) !== null) {
|
||||||
|
Object.getPrototypeOf(BaseController).apply(instance, arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inherits(BaseController, _Chaplin$Controller);
|
_inherits(BaseController, _Chaplin$Controller);
|
||||||
@ -22,7 +22,9 @@ var BaseController2 = (function (_Chaplin$Controller$Another) {
|
|||||||
function BaseController2() {
|
function BaseController2() {
|
||||||
_classCallCheck(this, BaseController2);
|
_classCallCheck(this, BaseController2);
|
||||||
|
|
||||||
_classSuperConstructorCall(this, BaseController2);
|
if (Object.getPrototypeOf(BaseController2) !== null) {
|
||||||
|
Object.getPrototypeOf(BaseController2).apply(instance, arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inherits(BaseController2, _Chaplin$Controller$Another);
|
_inherits(BaseController2, _Chaplin$Controller$Another);
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var _classSuperConstructorCall = function (instance, Constructor) { if (Object.getPrototypeOf(Constructor) !== null) { Object.getPrototypeOf(Constructor).apply(instance, arguments); } };
|
|
||||||
|
|
||||||
var _inherits = function (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) subClass.__proto__ = superClass; };
|
var _inherits = function (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) subClass.__proto__ = superClass; };
|
||||||
|
|
||||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||||
@ -10,7 +8,9 @@ var Test = (function (Foo) {
|
|||||||
function Test() {
|
function Test() {
|
||||||
_classCallCheck(this, Test);
|
_classCallCheck(this, Test);
|
||||||
|
|
||||||
_classSuperConstructorCall(this, Test);
|
if (Object.getPrototypeOf(Test) !== null) {
|
||||||
|
Object.getPrototypeOf(Test).apply(instance, arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inherits(Test, Foo);
|
_inherits(Test, Foo);
|
||||||
|
|||||||
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
var _defaults = function (obj, defaults) { for (var key in defaults) { if (obj[key] === undefined) { obj[key] = defaults[key]; } } return obj; };
|
var _defaults = function (obj, defaults) { for (var key in defaults) { if (obj[key] === undefined) { obj[key] = defaults[key]; } } return obj; };
|
||||||
|
|
||||||
var _classSuperConstructorCall = function (instance, Constructor) { if (Object.getPrototypeOf(Constructor) !== null) { Object.getPrototypeOf(Constructor).apply(instance, arguments); } };
|
|
||||||
|
|
||||||
var _inherits = function (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) _defaults(subClass, superClass); };
|
var _inherits = function (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) _defaults(subClass, superClass); };
|
||||||
|
|
||||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||||
@ -12,7 +10,9 @@ var Foo = (function (Bar) {
|
|||||||
function Foo() {
|
function Foo() {
|
||||||
_classCallCheck(this, Foo);
|
_classCallCheck(this, Foo);
|
||||||
|
|
||||||
_classSuperConstructorCall(this, Foo);
|
if (Object.getPrototypeOf(Foo) !== null) {
|
||||||
|
Object.getPrototypeOf(Foo).apply(instance, arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inherits(Foo, Bar);
|
_inherits(Foo, Bar);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user