go/ast/edge: update Kind const doc comments - add godoc to explain the enum name syntax - remove the outdated Kind instability comment Change-Id: I09ea4efab1631bc46f740d2e2bb5546a6a6a6961 Reviewed-on: https://go-review.googlesource.com/c/tools/+/770480 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Madeline Kalil <mkalil@google.com> Reviewed-by: Madeline Kalil <mkalil@google.com>
diff --git a/go/ast/edge/edge.go b/go/ast/edge/edge.go index 4f6ccfd..4c1e61a 100644 --- a/go/ast/edge/edge.go +++ b/go/ast/edge/edge.go
@@ -12,7 +12,7 @@ "reflect" ) -// A Kind describes a field of an ast.Node struct. +// A Kind describes a field of an [ast.Node] struct. type Kind uint8 // String returns a description of the edge kind. @@ -49,13 +49,14 @@ return v.Interface().(ast.Node) // may be nil } +// Each [Kind] is named Type_Field, where Type is the +// [ast.Node] struct type and Field is the name of the field const ( Invalid Kind = iota // for nodes at the root of the traversal - // Kinds are sorted alphabetically. - // Numbering is not stable. - // Each is named Type_Field, where Type is the - // ast.Node struct type and Field is the name of the field + // As of Go1.26 these kinds are sorted alphabetically, but + // numbering must be stable, so any new addition of const should + // use a new value (be added at the end of the list). ArrayType_Elt ArrayType_Len