ssa: ChangeInterface
This commit is contained in:
@@ -198,6 +198,9 @@ func Interface(pkgPath, name string, methods []Imethod) *InterfaceType {
|
||||
|
||||
// NewItab returns a new itab.
|
||||
func NewItab(inter *InterfaceType, typ *Type) *Itab {
|
||||
if typ == nil {
|
||||
return nil
|
||||
}
|
||||
n := len(inter.Methods)
|
||||
size := itabHdrSize + uintptr(n)*pointerSize
|
||||
ptr := AllocU(size)
|
||||
@@ -246,7 +249,17 @@ func methods(u *abi.UncommonType, from string) []abi.Method {
|
||||
return u.ExportedMethods()
|
||||
}
|
||||
|
||||
func IfaceData(i iface) unsafe.Pointer {
|
||||
func IfaceType(i iface) *abi.Type {
|
||||
if i.tab == nil {
|
||||
return nil
|
||||
}
|
||||
return i.tab._type
|
||||
}
|
||||
|
||||
func IfacePtrData(i iface) unsafe.Pointer {
|
||||
if i.tab == nil {
|
||||
panic(errorString("invalid memory address or nil pointer dereference").Error())
|
||||
}
|
||||
if i.tab._type.Kind_&abi.KindDirectIface != 0 {
|
||||
return unsafe.Pointer(&i.data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user