From: Keith Randall Date: Sat, 14 Jun 2025 23:38:26 +0000 (-0700) Subject: internal/reflectlite: fix comment about meaning of flag field X-Git-Tag: go1.25rc2~2^2~53 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3254c2bb83;p=gostls13.git internal/reflectlite: fix comment about meaning of flag field 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase --- diff --git a/src/internal/reflectlite/value.go b/src/internal/reflectlite/value.go index c38b498ea7..7b231d554f 100644 --- a/src/internal/reflectlite/value.go +++ b/src/internal/reflectlite/value.go @@ -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