diff --git a/lib/nodes.js b/lib/nodes.js index c00fde56..83be0b3d 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1102,7 +1102,7 @@ this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)")); } if (this.externalCtor) { - this.ctor.body.push(new Literal("return " + this.externalCtor + ".apply(this, arguments)")); + this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); } this.body.expressions.unshift(this.ctor); } diff --git a/src/nodes.coffee b/src/nodes.coffee index 55755ff8..bd594e42 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -862,7 +862,7 @@ exports.Class = class Class extends Base if not @ctor @ctor = new Code @ctor.body.push new Literal "#{name}.__super__.constructor.apply(this, arguments)" if @parent - @ctor.body.push new Literal "return #{@externalCtor}.apply(this, arguments)" if @externalCtor + @ctor.body.push new Literal "#{@externalCtor}.apply(this, arguments)" if @externalCtor @body.expressions.unshift @ctor @ctor.ctor = @ctor.name = name @ctor.klass = null diff --git a/test/classes.coffee b/test/classes.coffee index a0ad1f8e..365e9b33 100644 --- a/test/classes.coffee +++ b/test/classes.coffee @@ -470,6 +470,7 @@ test "#1182: execution order needs to be considered as well", -> test "#1182: external constructors with bound functions", -> fn = -> + {one: 1} class B class A constructor: fn