]> Cypherpunks repositories - gostls13.git/commit
go/ast: record start and end of file in File.File{Start,End}
authorAlan Donovan <adonovan@google.com>
Fri, 2 Sep 2022 15:13:43 +0000 (11:13 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 28 Sep 2022 20:37:59 +0000 (20:37 +0000)
commitf1d281fe4d6177349032776c22ab6dfb8533f0eb
tree7fdfe64648cc9efbad93f74a67414be6f83953d7
parentdbf174d4b9dd96b225a1f10089478f8257a54f80
go/ast: record start and end of file in File.File{Start,End}

This change causes the parser to record the positions of the first
and last character in the file in new ast.File fields FileStart
and FileEnd.

The behavior of the existing Pos() and End() methods,
which record the span of declarations, must remain unchanged
for compatibility.

Fixes golang/go#53202

Change-Id: I250b19e69f41e3590292c3fe6dea1943ec98f629
Reviewed-on: https://go-review.googlesource.com/c/go/+/427955
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
api/next/53202.txt [new file with mode: 0644]
src/go/ast/ast.go
src/go/ast/example_test.go
src/go/ast/filter.go
src/go/parser/parser.go
src/go/parser/parser_test.go