]> Cypherpunks repositories - gostls13.git/commitdiff
internal/reflectlite: remove redundent ifaceIndir
authorapocelipes <seve3r@outlook.com>
Tue, 7 May 2024 13:32:42 +0000 (13:32 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 7 May 2024 17:01:54 +0000 (17:01 +0000)
Use abi.(*Type).IfaceIndir instead.

Change-Id: I55a1a593d76601fb615d131abcf1b32012741e8c
GitHub-Last-Rev: 14de2a9d673dcd305a850e7b9217949160433488
GitHub-Pull-Request: golang/go#67228
Reviewed-on: https://go-review.googlesource.com/c/go/+/583756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
src/internal/reflectlite/export_test.go
src/internal/reflectlite/type.go
src/internal/reflectlite/value.go

index ea937b8db758d9ce9d4e0d3ebd945113e2e954a0..0ad3d97c15f9957423e2230bef129e801da9d956 100644 (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}
index af581d3a71c61a4362b40cabe88073a07c07448c..88cc50db9eda358176b1dd48f3e9c444782d08be 100644 (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
-}
index f898b861086fcfcc54e7a33a161b788ce23b082e..c38b498ea7e24c6d2825b067746d0f9fb637c160 100644 (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}