return name
}
+// Fake package for runtime type info (headers)
+// Don't access directly, use typeLookup below.
+var typepkg = types.NewPkg("type", "type")
+
+func typeLookup(name string) *types.Sym {
+ // Keep this wrapper function as a future
+ // version may protect typepkg with a mutex.
+ return typepkg.Lookup(name)
+}
+
func typesym(t *types.Type) *types.Sym {
- return types.TypePkgLookup(typesymname(t))
+ return typeLookup(typesymname(t))
}
// tracksym returns the symbol for tracking use of field/method f, assumed
func typesymprefix(prefix string, t *types.Type) *types.Sym {
p := prefix + "." + t.ShortString()
- s := types.TypePkgLookup(p)
+ s := typeLookup(p)
//print("algsym: %s -> %+S\n", p, s);
// we use one algorithm table for all AMEM types of a given size
p := fmt.Sprintf(".alg%d", t.Width)
- s := types.TypePkgLookup(p)
+ s := typeLookup(p)
lsym = s.Linksym()
if s.AlgGen() {
return lsym
// make hash closure
p = fmt.Sprintf(".hashfunc%d", t.Width)
- hashfunc = types.TypePkgLookup(p).Linksym()
+ hashfunc = typeLookup(p).Linksym()
ot := 0
ot = dsymptr(hashfunc, ot, memhashvarlen, 0)
// make equality closure
p = fmt.Sprintf(".eqfunc%d", t.Width)
- eqfunc = types.TypePkgLookup(p).Linksym()
+ eqfunc = typeLookup(p).Linksym()
ot = 0
ot = dsymptr(eqfunc, ot, memequalvarlen, 0)
Syms: make(map[string]*Sym),
}
-// fake package for runtime type info (headers)
-var typepkg = NewPkg("type", "type")
-
-func TypePkgLookup(name string) *Sym {
- return typepkg.Lookup(name)
-}
-
func (pkg *Pkg) Lookup(name string) *Sym {
s, _ := pkg.LookupOK(name)
return s