Please correct me if I'm wrong, but my interpretation of the code is that the purpose of the Class.override function (as called from Class.prototype.implement), is to give the overriding (new) method access to the overridden (old) method in the this.parent field.
When I tried to use this, however, I got a error about too much recursion.
I think this is because this.parent is assigned object[name] during the function call, but by this point object[name] is already the inner var override function that is being called.
Changing the method to:
override: function(object, name, method) {
var parent = Class.prototyping,
parentMethod = (parent && object[name] == parent[name])
? parent[name] : object[name];
object[name] = function() {
var previous = this.parent;
this.parent = parentMethod;
var value = method.apply(this, arguments);
this.parent = previous;
return value;
};
}
seemed to solve the problem for me
Please correct me if I'm wrong, but my interpretation of the code is that the purpose of the
Class.overridefunction (as called fromClass.prototype.implement), is to give the overriding (new) method access to the overridden (old) method in thethis.parentfield.When I tried to use this, however, I got a error about too much recursion.
I think this is because
this.parentis assignedobject[name]during the function call, but by this pointobject[name]is already the innervar overridefunction that is being called.Changing the method to:
seemed to solve the problem for me