trackpkg = types.NewPkg("go.track", "go.track")
trackpkg.Prefix = "go.track" // not go%2etrack
- typepkg = types.NewPkg("type", "type")
-
// pseudo-package used for map zero values
mappkg = types.NewPkg("go.map", "go.map")
mappkg.Prefix = "go.map"
}
func typesym(t *types.Type) *types.Sym {
- return typepkg.Lookup(typesymname(t))
+ return types.TypePkgLookup(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 := typepkg.Lookup(p)
+ s := types.TypePkgLookup(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 = typepkg.Lookup(p)
+ s = types.TypePkgLookup(p)
if s.AlgGen() {
return s
// make hash closure
p = fmt.Sprintf(".hashfunc%d", t.Width)
- hashfunc = typepkg.Lookup(p)
+ hashfunc = types.TypePkgLookup(p)
ot := 0
ot = dsymptr(hashfunc, ot, Runtimepkg.Lookup("memhash_varlen"), 0)
// make equality closure
p = fmt.Sprintf(".eqfunc%d", t.Width)
- eqfunc = typepkg.Lookup(p)
+ eqfunc = types.TypePkgLookup(p)
ot = 0
ot = dsymptr(eqfunc, ot, Runtimepkg.Lookup("memequal_varlen"), 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