aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/type.go
diff options
context:
space:
mode:
authorqiulaidongfeng <2645477756@qq.com>2024-04-02 13:08:24 +0000
committerGopher Robot <gobot@golang.org>2024-04-02 15:10:48 +0000
commitdaaf1f222063174eb7f0938eee38f7f9f364263c (patch)
tree4187c39caf622b61276555ab72ad00f1145ad280 /src/runtime/type.go
parente3ec1ca17e339e21ca50fbdb375b4294783bc385 (diff)
downloadgo-daaf1f222063174eb7f0938eee38f7f9f364263c.tar.xz
all: use kind* of abi
For #59670 Change-Id: Id66e102f13e529dd041b68ce869026a56f0a1b9b GitHub-Last-Rev: 43aa9376f72bc02a9d86518cdc99494a6b2f8573 GitHub-Pull-Request: golang/go#65564 Reviewed-on: https://go-review.googlesource.com/c/go/+/562298 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/type.go')
-rw-r--r--src/runtime/type.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/runtime/type.go b/src/runtime/type.go
index 1150a53208..a2975c4a99 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -61,11 +61,11 @@ func (t rtype) pkgpath() string {
if u := t.uncommon(); u != nil {
return t.nameOff(u.PkgPath).Name()
}
- switch t.Kind_ & kindMask {
- case kindStruct:
+ switch t.Kind_ & abi.KindMask {
+ case abi.Struct:
st := (*structtype)(unsafe.Pointer(t.Type))
return st.PkgPath.Name()
- case kindInterface:
+ case abi.Interface:
it := (*interfacetype)(unsafe.Pointer(t.Type))
return it.PkgPath.Name()
}
@@ -338,8 +338,8 @@ func typesEqual(t, v *_type, seen map[_typePair]struct{}) bool {
if t == v {
return true
}
- kind := t.Kind_ & kindMask
- if kind != v.Kind_&kindMask {
+ kind := t.Kind_ & abi.KindMask
+ if kind != v.Kind_&abi.KindMask {
return false
}
rt, rv := toRType(t), toRType(v)
@@ -358,21 +358,21 @@ func typesEqual(t, v *_type, seen map[_typePair]struct{}) bool {
return false
}
}
- if kindBool <= kind && kind <= kindComplex128 {
+ if abi.Bool <= kind && kind <= abi.Complex128 {
return true
}
switch kind {
- case kindString, kindUnsafePointer:
+ case abi.String, abi.UnsafePointer:
return true
- case kindArray:
+ case abi.Array:
at := (*arraytype)(unsafe.Pointer(t))
av := (*arraytype)(unsafe.Pointer(v))
return typesEqual(at.Elem, av.Elem, seen) && at.Len == av.Len
- case kindChan:
+ case abi.Chan:
ct := (*chantype)(unsafe.Pointer(t))
cv := (*chantype)(unsafe.Pointer(v))
return ct.Dir == cv.Dir && typesEqual(ct.Elem, cv.Elem, seen)
- case kindFunc:
+ case abi.Func:
ft := (*functype)(unsafe.Pointer(t))
fv := (*functype)(unsafe.Pointer(v))
if ft.OutCount != fv.OutCount || ft.InCount != fv.InCount {
@@ -391,7 +391,7 @@ func typesEqual(t, v *_type, seen map[_typePair]struct{}) bool {
}
}
return true
- case kindInterface:
+ case abi.Interface:
it := (*interfacetype)(unsafe.Pointer(t))
iv := (*interfacetype)(unsafe.Pointer(v))
if it.PkgPath.Name() != iv.PkgPath.Name() {
@@ -420,19 +420,19 @@ func typesEqual(t, v *_type, seen map[_typePair]struct{}) bool {
}
}
return true
- case kindMap:
+ case abi.Map:
mt := (*maptype)(unsafe.Pointer(t))
mv := (*maptype)(unsafe.Pointer(v))
return typesEqual(mt.Key, mv.Key, seen) && typesEqual(mt.Elem, mv.Elem, seen)
- case kindPtr:
+ case abi.Pointer:
pt := (*ptrtype)(unsafe.Pointer(t))
pv := (*ptrtype)(unsafe.Pointer(v))
return typesEqual(pt.Elem, pv.Elem, seen)
- case kindSlice:
+ case abi.Slice:
st := (*slicetype)(unsafe.Pointer(t))
sv := (*slicetype)(unsafe.Pointer(v))
return typesEqual(st.Elem, sv.Elem, seen)
- case kindStruct:
+ case abi.Struct:
st := (*structtype)(unsafe.Pointer(t))
sv := (*structtype)(unsafe.Pointer(v))
if len(st.Fields) != len(sv.Fields) {