}
func TestMethodCallValueCodePtr(t *testing.T) {
- p := ValueOf(Point{}).Method(1).UnsafePointer()
+ m := ValueOf(Point{}).Method(1)
want := MethodValueCallCodePtr()
- if got := uintptr(p); got != want {
+ if got := uintptr(m.UnsafePointer()); got != want {
+ t.Errorf("methodValueCall code pointer mismatched, want: %v, got: %v", want, got)
+ }
+ if got := m.Pointer(); got != want {
t.Errorf("methodValueCall code pointer mismatched, want: %v, got: %v", want, got)
}
}
// created via reflect have the same underlying code pointer,
// so their Pointers are equal. The function used here must
// match the one used in makeMethodValue.
- f := methodValueCall
- return **(**uintptr)(unsafe.Pointer(&f))
+ return methodValueCallCodePtr()
}
p := v.pointer()
// Non-nil func value points at data block.