Skip to content

Commit

Permalink
go/ast: mention that FieldLists can now be enclosed by brackets
Browse files Browse the repository at this point in the history
Type parameter lists are stored using ast.FieldLists. Update the
documentation to reflect that the enclosing delimiter may be a bracket.

Change-Id: Id103e7b38975e94a1b521f75695edc10408ad3dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/378014
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
findleyr committed Jan 12, 2022
1 parent 6e8b7e4 commit 83bfdb6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/go/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ func (f *Field) End() token.Pos {
return token.NoPos
}

// A FieldList represents a list of Fields, enclosed by parentheses or braces.
// A FieldList represents a list of Fields, enclosed by parentheses,
// curly braces, or square brackets.
type FieldList struct {
Opening token.Pos // position of opening parenthesis/brace, if any
Opening token.Pos // position of opening parenthesis/brace/bracket, if any
List []*Field // field list; or nil
Closing token.Pos // position of closing parenthesis/brace, if any
Closing token.Pos // position of closing parenthesis/brace/bracket, if any
}

func (f *FieldList) Pos() token.Pos {
Expand Down

0 comments on commit 83bfdb6

Please sign in to comment.