Closed Bug 570382 Opened 12 years ago Closed 11 years ago
.prototype .to String doesn't work with proxy functions
At least Function.prototype.toString doesn't work right on callable objects. ES5 says that callable objects are of type Function (typeof RegExp == "function"), so this should probably made work. We should check for isCallable instead of isFunction.
"An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration. Note in particular that the use and placement of white space, line terminators, and semicolons within the representation String is implementation-dependent. The toString function is not generic; it throws a TypeError exception if its this value is not a Function object. Therefore, it cannot be transferred to other kinds of objects for use as a method." Looks like ES5 doesn't want all callable objects to be allowed here, only explicitly functions. So I will fix this narrowly for proxies.
Please resummarize -- summary is wrong, ES1-5 are clear on this :-P. /be
Summary: TM: Function.prototype.* doesn't work on callable objects → TM: Function.prototype.* doesn't work with proxy functions
Summary: TM: Function.prototype.* doesn't work with proxy functions → TM: Function.prototype.toString doesn't work with proxy functions
Works for Proxies and Functions, Ecma doesn't want anything more.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.