From 39b6fb7a19ff6384a55fdec25e1a816817b8b7ed Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 7 Oct 2011 08:54:02 -0700 Subject: [PATCH] go/token: remove obsolete comment (cleanup) R=r CC=golang-dev https://golang.org/cl/5235042 --- src/pkg/go/token/position.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pkg/go/token/position.go b/src/pkg/go/token/position.go index 9155b501d4..8cf3dcd25a 100644 --- a/src/pkg/go/token/position.go +++ b/src/pkg/go/token/position.go @@ -86,9 +86,11 @@ func searchFiles(a []*File, x int) int { } func (s *FileSet) file(p Pos) *File { + // common case: p is in last file touched if f := s.last; f != nil && f.base <= int(p) && int(p) <= f.base+f.size { return f } + // p is not in last file touched - search all files if i := searchFiles(s.files, int(p)); i >= 0 { f := s.files[i] // f.base <= int(p) by definition of searchFiles @@ -123,10 +125,6 @@ func (f *File) position(p Pos) (pos Position) { // Position converts a Pos in the fileset into a general Position. func (s *FileSet) Position(p Pos) (pos Position) { if p != NoPos { - // TODO(gri) consider optimizing the case where p - // is in the last file added, or perhaps - // looked at - will eliminate one level - // of search s.mutex.RLock() if f := s.file(p); f != nil { pos = f.position(p) -- 2.48.1