aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iimport.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-03-07 23:48:02 -0800
committerKeith Randall <khr@golang.org>2021-03-09 18:35:29 +0000
commit48895d021bf631f15d68ecc10cab89ebd9cb28f6 (patch)
tree257a91659a7cfea887ffb1b2fc08abc35668fcec /src/cmd/compile/internal/typecheck/iimport.go
parentb6df58bd1f3b2a05787f62bbec4267f7867d4bbd (diff)
downloadgo-48895d021bf631f15d68ecc10cab89ebd9cb28f6.tar.gz
go-48895d021bf631f15d68ecc10cab89ebd9cb28f6.zip
cmd/compile: remove skipping of implicit operations during export
We'll need to attach types to these operations, so we need to represent them in the import/export data. Some of the operations use a selector indicating a different package, so we need to provide an option to encode the package of a selector. The default selector() function can't encode that extra information, as selector's exact encoding is used by go/types. Change-Id: I4c110fe347b3d915f88a722834bc4058baea7854 Reviewed-on: https://go-review.googlesource.com/c/go/+/299771 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iimport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index 5c57373b66..91bb215a29 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -466,6 +466,21 @@ func (r *importReader) ident(selector bool) *types.Sym {
func (r *importReader) localIdent() *types.Sym { return r.ident(false) }
func (r *importReader) selector() *types.Sym { return r.ident(true) }
+func (r *importReader) exoticSelector() *types.Sym {
+ name := r.string()
+ if name == "" {
+ return nil
+ }
+ pkg := r.currPkg
+ if types.IsExported(name) {
+ pkg = types.LocalPkg
+ }
+ if r.uint64() != 0 {
+ pkg = r.pkg()
+ }
+ return pkg.Lookup(name)
+}
+
func (r *importReader) qualifiedIdent() *ir.Ident {
name := r.string()
pkg := r.pkg()
@@ -753,7 +768,7 @@ func (r *importReader) doInline(fn *ir.Func) {
base.Fatalf("%v already has inline body", fn)
}
- //fmt.Printf("Importing %v\n", n)
+ //fmt.Printf("Importing %s\n", fn.Nname.Sym().Name)
r.funcBody(fn)
importlist = append(importlist, fn)
@@ -1038,7 +1053,7 @@ func (r *importReader) node() ir.Node {
case ir.OXDOT:
// see parser.new_dotname
- return ir.NewSelectorExpr(r.pos(), ir.OXDOT, r.expr(), r.selector())
+ return ir.NewSelectorExpr(r.pos(), ir.OXDOT, r.expr(), r.exoticSelector())
// case ODOTTYPE, ODOTTYPE2:
// unreachable - mapped to case ODOTTYPE below by exporter