mirror of
https://github.com/golang/go
synced 2024-11-23 21:00:06 -07:00
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:
parent
d005736213
commit
79dbc1cc7b
@ -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() {
|
||||
|
@ -179,7 +179,7 @@ func buildssa(fn *Node, worker int) *ssa.Func {
|
||||
case PFUNC:
|
||||
// local function - already handled by frontend
|
||||
default:
|
||||
s.Fatalf("local variable with class %s unimplemented", classnames[n.Class()])
|
||||
s.Fatalf("local variable with class %v unimplemented", n.Class())
|
||||
}
|
||||
}
|
||||
|
||||
@ -3394,7 +3394,7 @@ func (s *state) addr(n *Node, bounded bool) *ssa.Value {
|
||||
// that cse works on their addresses
|
||||
return s.newValue1A(ssa.OpAddr, t, n, s.sp)
|
||||
default:
|
||||
s.Fatalf("variable address class %v not implemented", classnames[n.Class()])
|
||||
s.Fatalf("variable address class %v not implemented", n.Class())
|
||||
return nil
|
||||
}
|
||||
case OINDREGSP:
|
||||
|
Loading…
Reference in New Issue
Block a user