[Webkit-unassigned] [Bug 145605] Function.prototype.bind: Bound functions must use the [[Prototype]] of their target function instead of Function.prototype

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 11 11:18:47 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=145605

--- Comment #33 from Matthew Hill <matthew.jh at outlook.com> ---
Thanks Geoffrey. The reason for the cast was that it seemed to be necessary (see below).  

````
bool hasDefaultPrototype = targetPrototype == globalObject->functionPrototype();
````

doesn't compile. 

````
run-javascriptcore-tests

...

error: invalid operands to binary expression ('JSC::JSValue' and 'JSC::FunctionPrototype *')
    bool hasDefaultPrototype = targetPrototype == globalObject->functionPrototype();
                               ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
````

Even 

````
asObject(targetPrototype) == globalObject->functionPrototype();
````

doesn't compile with

````
error: comparison of distinct pointer types ('JSC::JSObject *' and 'JSC::FunctionPrototype *')
    bool hasDefaultPrototype = asObject(targetPrototype) == globalObject->functionPrototype();
                               ~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
````

which I don't understand because as you rightly say, FunctionPrototype inherits from JSObject

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150911/de9f3b06/attachment.html>


More information about the webkit-unassigned mailing list