cmd/compile: move and rename mkpkg to types.NewPkg

That's where it belongs. Also, moved pkgMap and pkgs globals.

Change-Id: I531727fe5ce162c403efefec82f4cc90afa326d7
Reviewed-on: https://go-review.googlesource.com/41071
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2017-04-19 10:03:35 -07:00
parent ff7994ac10
commit ec241db2fd
8 changed files with 45 additions and 42 deletions

View file

@ -1957,23 +1957,6 @@ func ngotype(n *Node) *types.Sym {
return nil
}
var pkgMap = make(map[string]*types.Pkg)
var pkgs []*types.Pkg
func mkpkg(path string) *types.Pkg {
if p := pkgMap[path]; p != nil {
return p
}
p := new(types.Pkg)
p.Path = path
p.Prefix = objabi.PathToPrefix(path)
p.Syms = make(map[string]*types.Sym)
pkgMap[path] = p
pkgs = append(pkgs, p)
return p
}
// The result of addinit MUST be assigned back to n, e.g.
// n.Left = addinit(n.Left, init)
func addinit(n *Node, init []*Node) *Node {