mirror of
https://github.com/golang/go
synced 2024-11-23 01:30:02 -07:00
Revert "go/printer: reuse go/token.FileSet.PositionFor calls in setPos"
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>
This commit is contained in:
parent
e78871ea07
commit
267b50a834
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user