Skip to content

Commit 3254c2b

Browse files
committed
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 <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
1 parent 816199e commit 3254c2b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/internal/reflectlite/value.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,19 @@ type Value struct {
4343
ptr unsafe.Pointer
4444

4545
// flag holds metadata about the value.
46-
// The lowest bits are flag bits:
46+
//
47+
// The lowest five bits give the Kind of the value, mirroring typ.Kind().
48+
//
49+
// The next set of bits are flag bits:
4750
// - flagStickyRO: obtained via unexported not embedded field, so read-only
4851
// - flagEmbedRO: obtained via unexported embedded field, so read-only
4952
// - flagIndir: val holds a pointer to the data
50-
// - flagAddr: v.CanAddr is true (implies flagIndir)
51-
// Value cannot represent method values.
52-
// The next five bits give the Kind of the value.
53-
// This repeats typ.Kind() except for method values.
54-
// The remaining 23+ bits give a method number for method values.
55-
// If flag.kind() != Func, code can assume that flagMethod is unset.
53+
// - flagAddr: v.CanAddr is true (implies flagIndir and ptr is non-nil)
54+
// - flagMethod: v is a method value.
5655
// If ifaceIndir(typ), code can assume that flagIndir is set.
56+
//
57+
// The remaining 22+ bits give a method number for method values.
58+
// If flag.kind() != Func, code can assume that flagMethod is unset.
5759
flag
5860

5961
// A method value represents a curried method invocation

0 commit comments

Comments
 (0)