diff options
author | Keith Randall <khr@golang.org> | 2021-04-20 15:36:11 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-04-20 23:41:54 +0000 |
commit | e12b0afa5454c7683cb27bef0b6979f964dd0e96 (patch) | |
tree | e6bde57c389b6ed24e92548d08a20cdf0fcce39f /src/cmd/compile/internal/typecheck/iimport.go | |
parent | 48e3d924548ce6b96f55ff74e40f9a16449ac659 (diff) | |
download | go-e12b0afa5454c7683cb27bef0b6979f964dd0e96.tar.gz go-e12b0afa5454c7683cb27bef0b6979f964dd0e96.zip |
cmd/compile: separate out parameter and field export encoding
These two types of *types.Field encode different concepts, so we
encode them separately (and ignore fields that don't matter for
each concept).
Change-Id: I9d1608413949a109f12a3ebd52cd7af5f476e415
Reviewed-on: https://go-review.googlesource.com/c/go/+/312130
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iimport.go')
-rw-r--r-- | src/cmd/compile/internal/typecheck/iimport.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go index 53576bf725..8c197215d7 100644 --- a/src/cmd/compile/internal/typecheck/iimport.go +++ b/src/cmd/compile/internal/typecheck/iimport.go @@ -592,7 +592,21 @@ func (r *importReader) exoticParam() *types.Field { f.Nname = ir.NewNameAt(pos, sym) } f.SetIsDDD(ddd) - f.Note = r.string() + return f +} + +func (r *importReader) exoticField() *types.Field { + pos := r.pos() + sym := r.exoticSym() + off := r.uint64() + typ := r.exoticType() + note := r.string() + f := types.NewField(pos, sym, typ) + f.Offset = int64(off) + if sym != nil { + f.Nname = ir.NewNameAt(pos, sym) + } + f.Note = note return f } @@ -1202,7 +1216,7 @@ func (r *importReader) node() ir.Node { n.SetType(r.exoticType()) switch op { case ir.ODOT, ir.ODOTPTR, ir.ODOTINTER: - n.Selection = r.exoticParam() + n.Selection = r.exoticField() case ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR: // These require a Lookup to link to the correct declaration. rcvrType := expr.Type() |