]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "go/printer: reuse go/token.FileSet.PositionFor calls in setPos"
authorThan McIntosh <thanm@google.com>
Tue, 11 Apr 2023 14:15:36 +0000 (14:15 +0000)
committerThan McIntosh <thanm@google.com>
Tue, 11 Apr 2023 14:38:41 +0000 (14:38 +0000)
This reverts commit http://go.dev/cl/461739

Reason for revert: Causes longtest failures due to odd formatting.

Change-Id: I7e31ff107e730b6d667866ea7718bc8632760422
Reviewed-on: https://go-review.googlesource.com/c/go/+/483676
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/go/printer/printer.go

index c90791556e374795d3fd7e458383d87f8e8df752..741e3f782c1492f66285dbcf5cbea103d9e97324 100644 (file)
@@ -878,12 +878,8 @@ func mayCombine(prev token.Token, next byte) (b bool) {
 }
 
 func (p *printer) setPos(pos token.Pos) {
-       // If p.pos is already equivalent to pos,
-       // we can avoid calling posFor again.
        if pos.IsValid() {
-               if file := p.fset.File(pos); file != nil && file.Offset(pos) != p.pos.Offset {
-                       p.pos = p.posFor(pos) // accurate position of next item
-               }
+               p.pos = p.posFor(pos) // accurate position of next item
        }
 }