This project is archived and is in readonly mode.

#813 ✓wontfix

Extend a wrapped function with toString to return the functions' source and not the wrap function

Reported by elado | December 19th, 2009 @ 02:14 PM

The Class' Native is extended by:

    wrap: function(self, key, method){
        if (method._origin) method = method._origin;
        return function(){
            if (method._protected && this._current == null) throw new Error('The method "' + key + '" cannot be called.');
            var caller = this.caller, current = this._current;
            this.caller = current; this._current = arguments.callee;
            var result = method.apply(this, arguments);
            this._current = current; this.caller = caller;
            return result;
        }.extend({_owner: self, _origin: method, _name: key});


When alerting/logging a function that has been wrapped (any method of a class), it returns the wrap function and not the original method's source.

I suggest to add a toString:

      }.extend({_owner: self, _origin: method, _name: key, toString:function () { return method.toString(); }});


      }.extend({_owner: self, _origin: method, _name: key, toString:function () { return "[wrapped: "+method.toString()+"]"; }});

It's good for debugging.


Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket