Skip to content

Commit 02a888e

Browse files
mateusz834adonovan
authored andcommitted
go/ast: document that (*ast.File).Comments is sorted by position
This is the way that go/parser produces it and in every AST manipulation that we do, we preserve such property. Also printer expects it is such order. Change-Id: I6a6a696424a679a2cf1f9bb7eb41bdd47523efa9 Reviewed-on: https://go-review.googlesource.com/c/go/+/704255 Reviewed-by: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Alan Donovan <[email protected]>
1 parent 594deca commit 02a888e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/go/ast/ast.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ type File struct {
10641064
Scope *Scope // package scope (this file only). Deprecated: see Object
10651065
Imports []*ImportSpec // imports in this file
10661066
Unresolved []*Ident // unresolved identifiers in this file. Deprecated: see Object
1067-
Comments []*CommentGroup // list of all comments in the source file
1067+
Comments []*CommentGroup // comments in the file, in lexical order
10681068
GoVersion string // minimum Go version required by //go:build or // +build directives
10691069
}
10701070

0 commit comments

Comments
 (0)