aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/export.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-11-25 00:30:58 -0500
committerRuss Cox <rsc@golang.org>2020-11-25 17:30:40 +0000
commitc26aead50c3c8226c51fb97a94852f2134b881aa (patch)
treeb6e9d775fce43b9c96d290e73adc6403eff13514 /src/cmd/compile/internal/gc/export.go
parentacb4d1cef14529585266df1868045f80e37ae081 (diff)
downloadgo-c26aead50c3c8226c51fb97a94852f2134b881aa.tar.gz
go-c26aead50c3c8226c51fb97a94852f2134b881aa.zip
[dev.regabi] cmd/compile: convert types.Node (a pointer) to types.IRNode (an interface)
The pointer hack was nice and saved a word, but it's untenable in a world where nodes are themselves interfaces with different underlying types. Bite the bullet and use an interface to hold the Node when in types.Sym and types.Type. This has the nice benefit of removing AsTypesNode entirely. AsNode is still useful because of its nil handling. Change-Id: I298cba9ff788b956ee287283bec78010e8b601e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/272933 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/export.go')
-rw-r--r--src/cmd/compile/internal/gc/export.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/gc/export.go b/src/cmd/compile/internal/gc/export.go
index 1f0288a591..ace461fc90 100644
--- a/src/cmd/compile/internal/gc/export.go
+++ b/src/cmd/compile/internal/gc/export.go
@@ -86,7 +86,7 @@ func importsym(ipkg *types.Pkg, s *types.Sym, op ir.Op) *ir.Node {
}
n = dclname(s)
- s.SetPkgDef(ir.AsTypesNode(n))
+ s.SetPkgDef(n)
s.Importdef = ipkg
}
if n.Op() != ir.ONONAME && n.Op() != op {
@@ -103,7 +103,7 @@ func importtype(ipkg *types.Pkg, pos src.XPos, s *types.Sym) *types.Type {
if n.Op() != ir.OTYPE {
t := types.New(types.TFORW)
t.Sym = s
- t.Nod = ir.AsTypesNode(n)
+ t.Nod = n
n.SetOp(ir.OTYPE)
n.SetPos(pos)