1
0
mirror of https://github.com/golang/go synced 2024-11-15 00:50:32 -07:00

internal/reflectlite: remove redundent ifaceIndir

Use abi.(*Type).IfaceIndir instead.
This commit is contained in:
apocelipes 2024-05-07 21:19:52 +08:00
parent ad10fbd3c4
commit 14de2a9d67
3 changed files with 3 additions and 8 deletions

View File

@ -70,7 +70,7 @@ func Zero(typ Type) Value {
}
t := typ.common()
fl := flag(t.Kind())
if ifaceIndir(t) {
if t.IfaceIndir() {
return Value{t, unsafe_New(t), fl | flagIndir}
}
return Value{t, nil, fl}

View File

@ -641,8 +641,3 @@ func toType(t *abi.Type) Type {
}
return toRType(t)
}
// ifaceIndir reports whether t is stored indirectly in an interface value.
func ifaceIndir(t *abi.Type) bool {
return abi.Kind(t.Kind_)&abi.KindDirectIface == 0
}

View File

@ -116,7 +116,7 @@ func packEface(v Value) any {
e := (*abi.EmptyInterface)(unsafe.Pointer(&i))
// First, fill in the data portion of the interface.
switch {
case ifaceIndir(t):
case t.IfaceIndir():
if v.flag&flagIndir == 0 {
panic("bad indir")
}
@ -153,7 +153,7 @@ func unpackEface(i any) Value {
return Value{}
}
f := flag(t.Kind())
if ifaceIndir(t) {
if t.IfaceIndir() {
f |= flagIndir
}
return Value{t, e.Data, f}