]> Cypherpunks repositories - gostls13.git/commitdiff
go/ast: minor cleanup
authorRobert Griesemer <gri@golang.org>
Tue, 27 Nov 2012 01:17:49 +0000 (17:17 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 27 Nov 2012 01:17:49 +0000 (17:17 -0800)
It's better to use IsValid() then checking a (possibly
partially set up) position against NoPos directly.

R=dsymonds
CC=golang-dev
https://golang.org/cl/6855099

src/pkg/go/ast/import.go

index 2d4f69aaea6ca0c1776e509006a665ea8d89f51b..a68a4840f8e9131fd3720bc33e96d6bcc63bec1d 100644 (file)
@@ -20,7 +20,7 @@ func SortImports(fset *token.FileSet, f *File) {
                        break
                }
 
-               if d.Lparen == token.NoPos {
+               if !d.Lparen.IsValid() {
                        // Not a block: sorted by default.
                        continue
                }