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>
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
}
return p
}
-var Nopkg = &Pkg{
+var nopkg = &Pkg{
Syms: make(map[string]*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
}
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