]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile/internal/types: don't export Nopkg anymore
authorRobert Griesemer <gri@golang.org>
Wed, 19 Apr 2017 17:36:31 +0000 (10:36 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 19 Apr 2017 21:19:15 +0000 (21:19 +0000)
There's already special code to access it.

Change-Id: I28ca4f44a04262407ee9f1c826ada4e7eba44775
Reviewed-on: https://go-review.googlesource.com/41073
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/types/pkg.go

index 9e11f05140960fd1026759fd5e0cdc62edb6c606..977c3d74c6883fc864cc77c363a47184f3f76c4d 100644 (file)
@@ -90,7 +90,7 @@ func uncommonSize(t *types.Type) int { // Sizeof(runtime.uncommontype{})
 func makefield(name string, t *types.Type) *types.Field {
        f := types.NewField()
        f.Type = t
-       f.Sym = types.Nopkg.Lookup(name)
+       f.Sym = (*types.Pkg)(nil).Lookup(name)
        return f
 }
 
index 46a5606fc2807f58a192cbad3bfd161ee32e2ce2..b43f13e5d184a6d7367b856c51c52c95772d969c 100644 (file)
@@ -45,7 +45,7 @@ func NewPkg(path, name string) *Pkg {
        return p
 }
 
-var Nopkg = &Pkg{
+var nopkg = &Pkg{
        Syms: make(map[string]*Sym),
 }
 
@@ -58,8 +58,9 @@ var InitSyms []*Sym
 
 // LookupOK looks up name in pkg and reports whether it previously existed.
 func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) {
+       // TODO(gri) remove this check in favor of specialized lookup
        if pkg == nil {
-               pkg = Nopkg
+               pkg = nopkg
        }
        if s := pkg.Syms[name]; s != nil {
                return s, true
@@ -77,8 +78,9 @@ func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) {
 }
 
 func (pkg *Pkg) LookupBytes(name []byte) *Sym {
+       // TODO(gri) remove this check in favor of specialized lookup
        if pkg == nil {
-               pkg = Nopkg
+               pkg = nopkg
        }
        if s := pkg.Syms[string(name)]; s != nil {
                return s