mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 11:13:27 +00:00
reflect: add UnsafePointer() for Func types
This commit is contained in:
@@ -189,8 +189,12 @@ func (v Value) UnsafePointer() unsafe.Pointer {
|
|||||||
slice := (*sliceHeader)(v.value)
|
slice := (*sliceHeader)(v.value)
|
||||||
return slice.data
|
return slice.data
|
||||||
case Func:
|
case Func:
|
||||||
panic("unimplemented: (reflect.Value).UnsafePointer()")
|
fn := (*funcHeader)(v.value)
|
||||||
default: // not implemented: Func
|
if fn.Context != nil {
|
||||||
|
return fn.Context
|
||||||
|
}
|
||||||
|
return fn.Code
|
||||||
|
default:
|
||||||
panic(&ValueError{Method: "UnsafePointer", Kind: v.Kind()})
|
panic(&ValueError{Method: "UnsafePointer", Kind: v.Kind()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user