diff --git a/lib/nodes.js b/lib/nodes.js index bbf3e84484..f5757ccc90 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1117,10 +1117,10 @@ lname = new Literal(name); this.setContext(name); this.walkBody(name, o); - this.ensureConstructor(name); if (this.parent) { this.body.expressions.unshift(new Extends(lname, this.parent)); } + this.ensureConstructor(name); if (!(this.ctor instanceof Code)) { this.body.expressions.unshift(this.ctor); } diff --git a/src/nodes.coffee b/src/nodes.coffee index 0e448d3860..7a5dd476ac 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -896,8 +896,8 @@ exports.Class = class Class extends Base @setContext name @walkBody name, o - @ensureConstructor name @body.expressions.unshift new Extends lname, @parent if @parent + @ensureConstructor name @body.expressions.unshift @ctor unless @ctor instanceof Code @body.expressions.push lname @addBoundFunctions o