In this thread: https://groups.google.com/forum/#!topic/v8-users/Axf4hF_RfZo

it says:

> If your function has a signature that says that it must be called on a
particular type v8 will search the prototype chain for an object of
that type when the function is called.


Given my code, I don't understand why making an object that directly sets
its prototype as an object capable of calling a function with a signature
wouldn't be able to call that same function.

Is that thread I linked wrong?   Or am I misunderstanding something?

On Sun, May 28, 2017 at 11:57 PM, Jochen Eisinger <[email protected]>
wrote:

> A signature requires the object either be constructed from the same
> FunctionTemplate (as e.g. new MyType() does), or from a FunctionTemplate
> that inherited from the signature's FunctionTemplate.
>
> Note however that the "info.Holder" would still point at the receiver, and
> not the prototype with the matching signature :/
>
> On Sun, May 28, 2017 at 7:27 PM Zac Hansen <[email protected]> wrote:
>
>> I create a "constructor" FunctionTemplate, create a signature from that
>> FunctionTemplate, then on that FunctionTemplate's PrototypeObject
>> ObjectTemplate, I create a bunch of FunctionTemplate's using the signature
>> I generated before.
>>
>> I can call the function with objects created directly from the
>> "constructor" FunctionTemplate.  But if I call it from an object with that
>> object in the prototype chain, it doesn't work.
>>
>> base = new MyType();
>> derived = Object.create(base);  // setting .__proto__ has the same
>> behavior
>>
>> base.some_native_function(); <== works
>>
>> derived.some_native_function(); <== TypeError: Illegal invocation
>>
>>
>>
>> Anyone know what I might be doing wrong?  If I remove the signature,
>> everything works fine, but then holder == this when calling with derived,
>> which isn't what I want.
>>
>> --Zac
>>
>> --
>> --
>> v8-users mailing list
>> [email protected]
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/v8-users/dR8oI0ZwzG0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to