mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
better error for external super() call.
This commit is contained in:
@@ -482,6 +482,9 @@
|
|||||||
};
|
};
|
||||||
CallNode.prototype.superReference = function(o) {
|
CallNode.prototype.superReference = function(o) {
|
||||||
var meth, methname;
|
var meth, methname;
|
||||||
|
if (!(o.scope.method)) {
|
||||||
|
throw new Error("cannot call super outside of a function");
|
||||||
|
}
|
||||||
methname = o.scope.method.name;
|
methname = o.scope.method.name;
|
||||||
return (meth = (function() {
|
return (meth = (function() {
|
||||||
if (o.scope.method.proto) {
|
if (o.scope.method.proto) {
|
||||||
|
|||||||
@@ -439,6 +439,7 @@ exports.CallNode = class CallNode extends BaseNode
|
|||||||
|
|
||||||
# Grab the reference to the superclass' implementation of the current method.
|
# Grab the reference to the superclass' implementation of the current method.
|
||||||
superReference: (o) ->
|
superReference: (o) ->
|
||||||
|
throw new Error "cannot call super outside of a function" unless o.scope.method
|
||||||
methname = o.scope.method.name
|
methname = o.scope.method.name
|
||||||
meth = if o.scope.method.proto
|
meth = if o.scope.method.proto
|
||||||
"#{o.scope.method.proto}.__super__.#{methname}"
|
"#{o.scope.method.proto}.__super__.#{methname}"
|
||||||
|
|||||||
Reference in New Issue
Block a user