[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 14:21:24 PDT 2015


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

--- Comment #34 from Geoffrey Garen <ggaren at apple.com> ---
> error: invalid operands to binary expression ('JSC::JSValue' and
> 'JSC::FunctionPrototype *')
>     bool hasDefaultPrototype = targetPrototype ==
> globalObject->functionPrototype();

To provide the right type, use JSValue(globalObject->functionPrototype()).

> 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

In this formulation we have the right type but the compiler doesn't know it. So, you need to #include FunctionPrototype.h.

We shouldn't use this formulation, though, unless we can guarantee that the target callee in fact has a [[Prototype]]. I don't think we can guarantee that.

-- 
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/a2db77b2/attachment.html>


More information about the webkit-unassigned mailing list