]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/syntax: simpler position base update for line directives (cleanup)
authorRobert Griesemer <gri@golang.org>
Wed, 21 Feb 2018 04:14:51 +0000 (20:14 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 21 Feb 2018 21:06:36 +0000 (21:06 +0000)
commite2a86b6bd9d0b0a2be2d6de7259f50eae73ff7e0
treee74012f7b49b947196dc0cfcabbddf3b219700a6
parente02d6bb621a6c452cbef37946467f94a0054f2b1
cmd/compile/internal/syntax: simpler position base update for line directives (cleanup)

The existing code was somewhat convoluted and made several assumptions
about the encoding of position bases:

1) The position's base for a file contained a position whose base
   pointed to itself (which is true but an implementation detail
   of src.Pos).

2) Updating the position base for a line directive required finding
   the base of the most recent's base position.

This change simply stores the file's position base and keeps using it
directly for each line directive (instead of getting it from the most
recently updated base).

Change-Id: I4d80da513bededb636eab0ce53257fda73f0dbc0
Reviewed-on: https://go-review.googlesource.com/95736
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/syntax/parser.go