iface: todo

This commit is contained in:
xushiwei
2024-05-25 11:57:09 +08:00
parent c7abc03fee
commit 980a537930
6 changed files with 49 additions and 77 deletions

View File

@@ -13,11 +13,6 @@ type eface struct {
data unsafe.Pointer
}
/*
func efaceOf(ep *any) *eface {
return (*eface)(unsafe.Pointer(ep))
}
type iface struct {
tab *itab
data unsafe.Pointer
@@ -35,6 +30,11 @@ type itab struct {
fun [1]uintptr // variable sized. fun[0]==0 means _type does not implement inter.
}
/*
func efaceOf(ep *any) *eface {
return (*eface)(unsafe.Pointer(ep))
}
func MakeInterface(inter *InterfaceType, typ *Type, data unsafe.Pointer) Interface {
tab := &itab{inter: inter, _type: typ, hash: 0, fun: [1]uintptr{0}}
return Interface{