cmd/compile: replace classnames with Class.String

Since the slice of names is almost exactly the same as what stringer is
already generating for us.

Passes toolstash -cmp on std cmd.

Change-Id: I3f1e95efc690c0108236689e721627f00f79a461
Reviewed-on: https://go-review.googlesource.com/77190
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
Daniel Martí 2017-11-10 18:35:30 +00:00
parent d005736213
commit 79dbc1cc7b
2 changed files with 3 additions and 17 deletions

View file

@ -232,16 +232,6 @@ func (o Op) oconv(s fmt.State, flag FmtFlag, mode fmtMode) {
fmt.Fprint(s, o.String())
}
var classnames = []string{
"Pxxx",
"PEXTERN",
"PAUTO",
"PAUTOHEAP",
"PPARAM",
"PPARAMOUT",
"PFUNC",
}
type (
fmtMode int
@ -439,11 +429,7 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) {
}
if n.Class() != 0 {
if int(n.Class()) < len(classnames) {
fmt.Fprintf(s, " class(%s)", classnames[n.Class()])
} else {
fmt.Fprintf(s, " class(%d?)", n.Class())
}
fmt.Fprintf(s, " class(%v)", n.Class())
}
if n.Colas() {