On Tue, May 24, 2022 at 1:48 AM Wenhua Shi <march...@gmail.com> wrote:
>
> I'm really confusing.
>
> > That doesn't make sense to me. ifn and tfn need to refer to executable code.
> The code is copied from here 
> https://github.com/golang/go/blob/0da4dbe2322eb3b6224df35ce3e9fc83f104762b/src/reflect/type.go#L2368
>  , why is it working here?

Sorry, I see what you mean.  I'm not sure what is going on here and I
don't have the time to dig into it in detail myself.  Perhaps someone
else will take a look.

Ian


> >  ifn and tfn need to refer to executable code.
> I followed your advice and changed the code to `tfn:  
> resolveReflectText(ifn.ptr)`, but it still gave the same error.
>
> After I changed the `methodReceiver` func in `value.go` file, calling 
> `Dan.Method(0).Call([]reflect.Value{})` didn't panic any more,
> ```
> ifn := v.typ.textOff(m.ifn)
> fn = unsafe.Pointer(&ifn)
> ```
> to
> ```
> fn := v.typ.textOff(m.ifn)
> ```
> Why is `methodReceiver` taking address of `ifn` considering ifn is already a 
> pointer to the function?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/b773eb03-8b01-4a8f-a979-0451712b7e35n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXEtLQqGrjS8tFXJRFAgKDgmbCMUuZnvUixmspWwHFYqA%40mail.gmail.com.

Reply via email to