This commit is contained in:
Jeremy Ashkenas 2011-12-27 16:54:14 -08:00
parent 4a0e8139ea
commit 8dfec65034
3 changed files with 14 additions and 3 deletions

View File

@ -1264,7 +1264,7 @@
};
Class.prototype.compileNode = function(o) {
var call, decl, klass, lname, name;
var call, decl, klass, lname, name, params;
decl = this.determineName();
name = decl || '_Class';
if (name.reserved) name = "_" + name;
@ -1284,7 +1284,8 @@
this.superClass = new Literal(o.scope.freeVariable('super', false));
this.body.expressions.unshift(new Extends(lname, this.superClass));
call.args.push(this.parent);
call.variable.params.push(new Param(this.superClass));
params = call.variable.params || call.variable.base.params;
params.push(new Param(this.superClass));
}
klass = new Parens(call, true);
if (this.variable) klass = new Assign(this.variable, klass);

View File

@ -954,7 +954,8 @@ exports.Class = class Class extends Base
@superClass = new Literal o.scope.freeVariable 'super', no
@body.expressions.unshift new Extends lname, @superClass
call.args.push @parent
call.variable.params.push new Param @superClass
params = call.variable.params or call.variable.base.params
params.push new Param @superClass
klass = new Parens call, yes
klass = new Assign @variable, klass if @variable

View File

@ -610,3 +610,12 @@ test "#1966: external constructors should produce their return value", ->
ctor = -> {}
class A then constructor: ctor
ok (new A) not instanceof A
test "#1980: regression with an inherited class with static function members", ->
class A
class B extends A
@static: => 'value'
eq B.static(), 'value'