Stop anonymous supers.

This commit is contained in:
Tim Jones
2010-05-03 15:20:51 +12:00
committed by Jeremy Ashkenas
parent ee4e34bf6d
commit 4d935efd09
2 changed files with 11 additions and 2 deletions

View File

@@ -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.

View File

@@ -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) ->