]> Cypherpunks repositories - gostls13.git/commitdiff
internal/reflectlite: fix comment about meaning of flag field
authorKeith Randall <khr@golang.org>
Sat, 14 Jun 2025 23:38:26 +0000 (16:38 -0700)
committerKeith Randall <khr@google.com>
Mon, 16 Jun 2025 22:21:48 +0000 (15:21 -0700)
Copied current (presumably correct) comment text from reflect package.

Change-Id: I19582b3675fbcb96a925002498d24ad2b7bc6178
Reviewed-on: https://go-review.googlesource.com/c/go/+/681935
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
src/internal/reflectlite/value.go

index c38b498ea7e24c6d2825b067746d0f9fb637c160..7b231d554f50d11aaae1aeb9d8a4916b6f77ae7b 100644 (file)
@@ -43,17 +43,19 @@ type Value struct {
        ptr unsafe.Pointer
 
        // flag holds metadata about the value.
-       // The lowest bits are flag bits:
+       //
+       // The lowest five bits give the Kind of the value, mirroring typ.Kind().
+       //
+       // The next set of bits are flag bits:
        //      - flagStickyRO: obtained via unexported not embedded field, so read-only
        //      - flagEmbedRO: obtained via unexported embedded field, so read-only
        //      - flagIndir: val holds a pointer to the data
-       //      - flagAddr: v.CanAddr is true (implies flagIndir)
-       // Value cannot represent method values.
-       // The next five bits give the Kind of the value.
-       // This repeats typ.Kind() except for method values.
-       // The remaining 23+ bits give a method number for method values.
-       // If flag.kind() != Func, code can assume that flagMethod is unset.
+       //      - flagAddr: v.CanAddr is true (implies flagIndir and ptr is non-nil)
+       //      - flagMethod: v is a method value.
        // If ifaceIndir(typ), code can assume that flagIndir is set.
+       //
+       // The remaining 22+ bits give a method number for method values.
+       // If flag.kind() != Func, code can assume that flagMethod is unset.
        flag
 
        // A method value represents a curried method invocation