reflect,reflectlite: make IsRO/MakeRO package methods

Having them as methods on reflectlite.Value makes them
visible to the user.

Also move new functions out of all_test.go so it can stay
closer to upstream (except for comments).
This commit is contained in:
Damian Gryski
2026-06-30 09:26:55 -07:00
committed by Damian Gryski
parent 33ddee76db
commit 10224a4bf8
3 changed files with 22 additions and 12 deletions
-8
View File
@@ -4722,14 +4722,6 @@ var convertTests = []struct {
}
func IsRO(v Value) bool {
return v.IsRO()
}
func MakeRO(v Value) Value {
return Value{v.MakeRO(true)}
}
func TestConvert(t *testing.T) {
canConvert := map[[2]Type]bool{}
all := map[Type]bool{}
+11
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"encoding/base64"
"fmt"
"internal/reflectlite"
. "reflect"
"runtime"
"slices"
@@ -992,3 +993,13 @@ func TestTypeAssertPanic(t *testing.T) {
t.Fatalf("TypeAssert did not panic")
})
}
// Functions needed by all_test.go
func IsRO(v Value) bool {
return reflectlite.IsRO(v.Value)
}
func MakeRO(v Value) Value {
return Value{reflectlite.MakeRO(v.Value, true)}
}