]> Cypherpunks repositories - gostls13.git/commitdiff
go/token: remove obsolete comment (cleanup)
authorRobert Griesemer <gri@golang.org>
Fri, 7 Oct 2011 15:54:02 +0000 (08:54 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 7 Oct 2011 15:54:02 +0000 (08:54 -0700)
R=r
CC=golang-dev
https://golang.org/cl/5235042

src/pkg/go/token/position.go

index 9155b501d4d0419415682dcd2b29162cb13c1b96..8cf3dcd25a272a032f5dcad8969e2940ddfa7be8 100644 (file)
@@ -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)