mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: move types init code into package types
This moves the package types setup code from package typecheck into package types itself. This is a prereq for making types.Type more opaque, because some unit tests depend on being able to init the basic universal types. A few notable details of this CL: 1. Creating the builtin types requires being able to create the ir.Name/ir.OTYPE that represents it, but package types can't depend on package ir. So we add a callback function to handle creating the ir.Name. 2. This CL moves ir.Pkgs.Unsafe to types.UnsafePkg. Package unsafe is part of the language, not like the other ir.Pkgs packages that are purely implementation details. 3. This CL also moves typecheck.FakeRecv to types.FakeRecv, addressing an outstanding TODO. Change-Id: I64de04ce82fbcd1bb59f547e2eea3cda52d89429 Reviewed-on: https://go-review.googlesource.com/c/go/+/345474 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
af80af22b5
commit
967a8017f7
14 changed files with 171 additions and 160 deletions
|
|
@ -428,7 +428,7 @@ func (r *reader) interfaceType() *types.Type {
|
|||
pos := r.pos()
|
||||
pkg, sym := r.selector()
|
||||
tpkg = pkg
|
||||
mtyp := r.signature(pkg, typecheck.FakeRecv())
|
||||
mtyp := r.signature(pkg, types.FakeRecv())
|
||||
methods[i] = types.NewField(pos, sym, mtyp)
|
||||
}
|
||||
for i := range embeddeds {
|
||||
|
|
@ -540,7 +540,7 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
|||
if tag == objStub {
|
||||
assert(!sym.IsBlank())
|
||||
switch sym.Pkg {
|
||||
case types.BuiltinPkg, ir.Pkgs.Unsafe:
|
||||
case types.BuiltinPkg, types.UnsafePkg:
|
||||
return sym.Def.(ir.Node)
|
||||
}
|
||||
if pri, ok := objReader[sym]; ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue