[dev.regabi] cmd/compile: narrow interface between ir and types

Narrow the interface between package ir and package types
to make it easier to clean up the type formatting code all in one place.

Also introduce ir.BlankSym for use by OrigSym, so that later
OrigSym can move to package types without needing to reference
a variable of type ir.Node.

Passes buildall w/ toolstash -cmp.

Change-Id: I39fa419a1c8fb3318203e31cacc8d06399deeff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/275776
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Russ Cox 2020-12-05 15:20:51 -05:00
parent 3b25f3c150
commit fb17dfa43d
9 changed files with 59 additions and 67 deletions

View file

@ -654,6 +654,8 @@ func AsNode(n types.Object) Node {
var BlankNode Node
var BlankSym *types.Sym
// origSym returns the original symbol written by the user.
func OrigSym(s *types.Sym) *types.Sym {
if s == nil {
@ -666,7 +668,7 @@ func OrigSym(s *types.Sym) *types.Sym {
return nil
case 'b': // originally the blank identifier _
// TODO(mdempsky): Does s.Pkg matter here?
return BlankNode.Sym()
return BlankSym
}
return s
}