diff options
author | apocelipes <seve3r@outlook.com> | 2024-05-07 13:32:42 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-05-07 17:01:54 +0000 |
commit | c637d4b93912e072aa98bc8546e82b814065d02d (patch) | |
tree | 84f8eb929bc14ae27a00e5bbc682e446df04c0c6 /src/internal | |
parent | 348b23830d82aece5775eb9f7f3b3587cf5300c6 (diff) | |
download | go-c637d4b93912e072aa98bc8546e82b814065d02d.tar.gz go-c637d4b93912e072aa98bc8546e82b814065d02d.zip |
internal/reflectlite: remove redundent ifaceIndir
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>
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/reflectlite/export_test.go | 2 | ||||
-rw-r--r-- | src/internal/reflectlite/type.go | 5 | ||||
-rw-r--r-- | src/internal/reflectlite/value.go | 4 |
3 files changed, 3 insertions, 8 deletions
diff --git a/src/internal/reflectlite/export_test.go b/src/internal/reflectlite/export_test.go index ea937b8db7..0ad3d97c15 100644 --- a/src/internal/reflectlite/export_test.go +++ b/src/internal/reflectlite/export_test.go @@ -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} diff --git a/src/internal/reflectlite/type.go b/src/internal/reflectlite/type.go index af581d3a71..88cc50db9e 100644 --- a/src/internal/reflectlite/type.go +++ b/src/internal/reflectlite/type.go @@ -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 -} diff --git a/src/internal/reflectlite/value.go b/src/internal/reflectlite/value.go index f898b86108..c38b498ea7 100644 --- a/src/internal/reflectlite/value.go +++ b/src/internal/reflectlite/value.go @@ -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} |