Fixes #2721 -- show error message for naked super

This commit is contained in:
Jeremy Ashkenas 2013-03-01 13:25:49 +13:00
parent 6b79af2b7c
commit 5dea70b82e
2 changed files with 3 additions and 2 deletions

View File

@ -39,7 +39,8 @@
};
Scope.prototype.namedMethod = function() {
if (this.method.name || !this.parent) {
var _ref1;
if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) {
return this.method;
}
return this.parent.namedMethod();

View File

@ -41,7 +41,7 @@ can get complicated if super is being called from an inner function.
function object that has a name filled in, or bottoms out.
namedMethod: ->
return @method if @method.name or !@parent
return @method if @method?.name or !@parent
@parent.namedMethod()
Look up a variable name in lexical scope, and declare it if it does not