inline back the super constructor call helper - fixes #684

This commit is contained in:
Sebastian McKenzie
2015-02-04 08:39:45 +11:00
parent 86fbba08d8
commit 8d81a382f7
5 changed files with 20 additions and 28 deletions

View File

@@ -1,5 +1,3 @@
(function (instance, Constructor) {
if (Object.getPrototypeOf(Constructor) !== null) {
Object.getPrototypeOf(Constructor).apply(instance, arguments);
}
});
if (Object.getPrototypeOf(CLASS_NAME) !== null) {
Object.getPrototypeOf(CLASS_NAME).apply(instance, arguments);
}

View File

@@ -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
if (!this.hasConstructor && superName && !t.isFalsyExpression(superName)) {
var helperName = "class-super-constructor-call";
if (this.isLoose) {
constructor.body.body.push(util.template(helperName + "-loose", {
CLASS_NAME: className,
SUPER_NAME: this.superName
}, true));
} else {
constructor.body.body.push(
t.expressionStatement(
t.callExpression(this.file.addHelper(helperName), [t.thisExpression(), className])
)
);
}
if (this.isLoose) helperName += "-loose"
constructor.body.body.push(util.template(helperName, {
CLASS_NAME: className,
SUPER_NAME: this.superName
}, true));
}
var instanceProps;