better error for external super() call.

This commit is contained in:
Jeremy Ashkenas
2010-09-12 16:25:00 -04:00
parent 6b19e61bd0
commit b727245834
2 changed files with 4 additions and 0 deletions

View File

@@ -439,6 +439,7 @@ exports.CallNode = class CallNode extends BaseNode
# Grab the reference to the superclass' implementation of the current method.
superReference: (o) ->
throw new Error "cannot call super outside of a function" unless o.scope.method
methname = o.scope.method.name
meth = if o.scope.method.proto
"#{o.scope.method.proto}.__super__.#{methname}"