go/printer: correct cindex meaning in commentInfo comments

(*printer).nextComment increases cindex by one after each call
and it always points to the next element.

Change-Id: I65754ab6e30e10dc7473882e39737d2e0dc29070
GitHub-Last-Rev: f859283324
GitHub-Pull-Request: golang/go#68032
Reviewed-on: https://go-review.googlesource.com/c/go/+/592557
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Mateusz Poliwczak 2024-07-30 19:01:10 +00:00 committed by Gopher Robot
parent 1f72ce31f0
commit 96f7159705
1 changed files with 3 additions and 3 deletions

View File

@ -45,9 +45,9 @@ const (
)
type commentInfo struct {
cindex int // current comment index
comment *ast.CommentGroup // = printer.comments[cindex]; or nil
commentOffset int // = printer.posFor(printer.comments[cindex].List[0].Pos()).Offset; or infinity
cindex int // index of the next comment
comment *ast.CommentGroup // = printer.comments[cindex-1]; or nil
commentOffset int // = printer.posFor(printer.comments[cindex-1].List[0].Pos()).Offset; or infinity
commentNewline bool // true if the comment group contains newlines
}