Commit 62a2bee7 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile/internal/types: don't export Nopkg anymore

There's already special code to access it.

Change-Id: I28ca4f44a04262407ee9f1c826ada4e7eba44775
Reviewed-on: https://go-review.googlesource.com/41073Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent b2a363b7
...@@ -90,7 +90,7 @@ func uncommonSize(t *types.Type) int { // Sizeof(runtime.uncommontype{}) ...@@ -90,7 +90,7 @@ func uncommonSize(t *types.Type) int { // Sizeof(runtime.uncommontype{})
func makefield(name string, t *types.Type) *types.Field { func makefield(name string, t *types.Type) *types.Field {
f := types.NewField() f := types.NewField()
f.Type = t f.Type = t
f.Sym = types.Nopkg.Lookup(name) f.Sym = (*types.Pkg)(nil).Lookup(name)
return f return f
} }
......
...@@ -45,7 +45,7 @@ func NewPkg(path, name string) *Pkg { ...@@ -45,7 +45,7 @@ func NewPkg(path, name string) *Pkg {
return p return p
} }
var Nopkg = &Pkg{ var nopkg = &Pkg{
Syms: make(map[string]*Sym), Syms: make(map[string]*Sym),
} }
...@@ -58,8 +58,9 @@ var InitSyms []*Sym ...@@ -58,8 +58,9 @@ var InitSyms []*Sym
// LookupOK looks up name in pkg and reports whether it previously existed. // LookupOK looks up name in pkg and reports whether it previously existed.
func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) { func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) {
// TODO(gri) remove this check in favor of specialized lookup
if pkg == nil { if pkg == nil {
pkg = Nopkg pkg = nopkg
} }
if s := pkg.Syms[name]; s != nil { if s := pkg.Syms[name]; s != nil {
return s, true return s, true
...@@ -77,8 +78,9 @@ func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) { ...@@ -77,8 +78,9 @@ func (pkg *Pkg) LookupOK(name string) (s *Sym, existed bool) {
} }
func (pkg *Pkg) LookupBytes(name []byte) *Sym { func (pkg *Pkg) LookupBytes(name []byte) *Sym {
// TODO(gri) remove this check in favor of specialized lookup
if pkg == nil { if pkg == nil {
pkg = Nopkg pkg = nopkg
} }
if s := pkg.Syms[string(name)]; s != nil { if s := pkg.Syms[string(name)]; s != nil {
return s return s
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment