mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
Stop anonymous supers.
This commit is contained in:
committed by
Jeremy Ashkenas
parent
ee4e34bf6d
commit
4d935efd09
10
lib/nodes.js
10
lib/nodes.js
@@ -512,7 +512,15 @@
|
|||||||
CallNode.prototype.super_reference = function super_reference(o) {
|
CallNode.prototype.super_reference = function super_reference(o) {
|
||||||
var meth, methname;
|
var meth, methname;
|
||||||
methname = o.scope.method.name;
|
methname = o.scope.method.name;
|
||||||
meth = o.scope.method.proto ? ("" + (o.scope.method.proto) + ".__superClass__." + methname) : ("" + (methname) + ".__superClass__.constructor");
|
meth = (function() {
|
||||||
|
if (o.scope.method.proto) {
|
||||||
|
return "" + (o.scope.method.proto) + ".__superClass__." + methname;
|
||||||
|
} else if (methname) {
|
||||||
|
return "" + (methname) + ".__superClass__.constructor";
|
||||||
|
} else {
|
||||||
|
throw new Error("cannot call super on an anonymous function.");
|
||||||
|
}
|
||||||
|
})();
|
||||||
return meth;
|
return meth;
|
||||||
};
|
};
|
||||||
// Compile a vanilla function call.
|
// Compile a vanilla function call.
|
||||||
|
|||||||
@@ -371,8 +371,9 @@ exports.CallNode: class CallNode extends BaseNode
|
|||||||
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}.__superClass__.$methname"
|
"${o.scope.method.proto}.__superClass__.$methname"
|
||||||
else
|
else if methname
|
||||||
"${methname}.__superClass__.constructor"
|
"${methname}.__superClass__.constructor"
|
||||||
|
else throw new Error "cannot call super on an anonymous function."
|
||||||
|
|
||||||
# Compile a vanilla function call.
|
# Compile a vanilla function call.
|
||||||
compile_node: (o) ->
|
compile_node: (o) ->
|
||||||
|
|||||||
Reference in New Issue
Block a user