diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-08-26 13:17:56 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-08-26 22:37:54 +0000 |
commit | 967a8017f7d41717335ee020e46e2c55c5c9e96e (patch) | |
tree | b1ec12b24cfd28630301df4d6a487818d8e71af0 /src/cmd/compile/internal/reflectdata/reflect.go | |
parent | af80af22b507ae23ae04372f30b98f7720c85f8a (diff) | |
download | go-967a8017f7d41717335ee020e46e2c55c5c9e96e.tar.gz go-967a8017f7d41717335ee020e46e2c55c5c9e96e.zip |
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>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata/reflect.go')
-rw-r--r-- | src/cmd/compile/internal/reflectdata/reflect.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index 9b9efe04a2..deb806beac 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -1726,7 +1726,7 @@ func NeedEmit(typ *types.Type) bool { // Local defined type; our responsibility. return true - case base.Ctxt.Pkgpath == "runtime" && (sym.Pkg == types.BuiltinPkg || sym.Pkg == ir.Pkgs.Unsafe): + case base.Ctxt.Pkgpath == "runtime" && (sym.Pkg == types.BuiltinPkg || sym.Pkg == types.UnsafePkg): // Package runtime is responsible for including code for builtin // types (predeclared and package unsafe). return true |