Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: merge flag* const info internal/reflectlite #64908

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
12 changes: 7 additions & 5 deletions src/cmd/compile/internal/test/inl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ func TestIntendedInlining(t *testing.T) {
"Value.pointer",
"add",
"align",
"flag.mustBe",
"flag.mustBeAssignable",
"flag.mustBeExported",
"flag.kind",
"flag.ro",
},
"regexp": {
"(*bitState).push",
Expand Down Expand Up @@ -235,6 +230,13 @@ func TestIntendedInlining(t *testing.T) {
"(*Pointer[go.shape.int]).Store",
"(*Pointer[go.shape.int]).Swap",
},
"internal/reflectlite": {
"MustBe",
"Flag.MustBeAssignable",
"Flag.MustBeExported",
"Flag.Kind",
"Flag.Ro",
},
}

if runtime.GOARCH != "386" && runtime.GOARCH != "loong64" && runtime.GOARCH != "mips64" && runtime.GOARCH != "mips64le" && runtime.GOARCH != "riscv64" {
Expand Down
14 changes: 7 additions & 7 deletions src/internal/reflectlite/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// Field returns the i'th field of the struct v.
// It panics if v's Kind is not Struct or i is out of range.
func Field(v Value, i int) Value {
if v.kind() != Struct {
panic(&ValueError{"reflect.Value.Field", v.kind()})
if v.Kind() != Struct {
panic(&ValueError{"reflect.Value.Field", v.Kind()})
}
tt := (*structType)(unsafe.Pointer(v.typ()))
if uint(i) >= uint(len(tt.Fields)) {
Expand All @@ -22,13 +22,13 @@ func Field(v Value, i int) Value {
typ := field.Typ

// Inherit permission bits from v, but clear flagEmbedRO.
fl := v.flag&(flagStickyRO|flagIndir|flagAddr) | flag(typ.Kind())
fl := v.Flag&(FlagStickyRO|FlagIndir|FlagAddr) | Flag(typ.Kind())
// Using an unexported field forces flagRO.
if !field.Name.IsExported() {
if field.Embedded() {
fl |= flagEmbedRO
fl |= FlagEmbedRO
} else {
fl |= flagStickyRO
fl |= FlagStickyRO
}
}
// Either flagIndir is set and v.ptr points at struct,
Expand Down Expand Up @@ -69,9 +69,9 @@ func Zero(typ Type) Value {
panic("reflect: Zero(nil)")
}
t := typ.common()
fl := flag(t.Kind())
fl := Flag(t.Kind())
if ifaceIndir(t) {
return Value{t, unsafe_New(t), fl | flagIndir}
return Value{t, unsafe_New(t), fl | FlagIndir}
}
return Value{t, nil, fl}
}
Expand Down
Loading