1
0
mirror of https://github.com/golang/go synced 2024-11-26 01:57:56 -07:00

go/ast: document invalid comment end positions with CRLF line endings

We've decided that issues like golang/go#41197 are unfixable, so
instead, document the bug.

Fixes golang/go#41197

Change-Id: I5649027f6e2445eec765516f2f642db0d601ea20
Reviewed-on: https://go-review.googlesource.com/c/go/+/270938
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Rebecca Stambler 2020-11-17 18:28:38 -05:00
parent bcfaeca58c
commit a14e7bf6d4

View File

@ -57,6 +57,11 @@ type Decl interface {
// Comments
// A Comment node represents a single //-style or /*-style comment.
//
// The Text field contains the comment text without carriage returns (\r) that
// may have been present in the source. Because a comment's end position is
// computed using len(Text), the position reported by End() does not match the
// true source end position for comments containing carriage returns.
type Comment struct {
Slash token.Pos // position of "/" starting the comment
Text string // comment text (excluding '\n' for //-style comments)