]> Cypherpunks repositories - gostls13.git/commitdiff
go/doc: add nil to list of predeclared constants
authorAndrew Gerrand <adg@golang.org>
Wed, 3 Oct 2012 22:37:48 +0000 (08:37 +1000)
committerAndrew Gerrand <adg@golang.org>
Wed, 3 Oct 2012 22:37:48 +0000 (08:37 +1000)
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6601054

src/pkg/go/doc/example.go
src/pkg/go/doc/reader.go

index dc899351a605f24a826363598041c9cecb6a977b..79053b9a7357bb1fb75bc1367b9f561cb421651a 100644 (file)
@@ -138,7 +138,7 @@ func playExample(file *ast.File, body *ast.BlockStmt) *ast.File {
 
        // Remove predeclared identifiers from unresolved list.
        for n := range unresolved {
-               if n == "nil" || predeclaredTypes[n] || predeclaredConstants[n] || predeclaredFuncs[n] {
+               if predeclaredTypes[n] || predeclaredConstants[n] || predeclaredFuncs[n] {
                        delete(unresolved, n)
                }
        }
index f0860391f6a6f222a7feb76f3187e5b619184be9..de42d47d9fe3676d849d28ed55c506e4f43452c6 100644 (file)
@@ -751,7 +751,7 @@ func sortedFuncs(m methodSet, allMethods bool) []*Func {
 }
 
 // ----------------------------------------------------------------------------
-// Predeclared identifiers (minus "nil")
+// Predeclared identifiers
 
 var predeclaredTypes = map[string]bool{
        "bool":       true,
@@ -795,7 +795,8 @@ var predeclaredFuncs = map[string]bool{
 }
 
 var predeclaredConstants = map[string]bool{
+       "false": true,
        "iota":  true,
+       "nil":   true,
        "true":  true,
-       "false": true,
 }