mirror of https://github.com/golang/go.git
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())
|
fmt.Fprint(s, o.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
var classnames = []string{
|
|
||||||
"Pxxx",
|
|
||||||
"PEXTERN",
|
|
||||||
"PAUTO",
|
|
||||||
"PAUTOHEAP",
|
|
||||||
"PPARAM",
|
|
||||||
"PPARAMOUT",
|
|
||||||
"PFUNC",
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
fmtMode int
|
fmtMode int
|
||||||
|
|
||||||
|
|
@ -439,11 +429,7 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.Class() != 0 {
|
if n.Class() != 0 {
|
||||||
if int(n.Class()) < len(classnames) {
|
fmt.Fprintf(s, " class(%v)", n.Class())
|
||||||
fmt.Fprintf(s, " class(%s)", classnames[n.Class()])
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(s, " class(%d?)", n.Class())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.Colas() {
|
if n.Colas() {
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ func buildssa(fn *Node, worker int) *ssa.Func {
|
||||||
case PFUNC:
|
case PFUNC:
|
||||||
// local function - already handled by frontend
|
// local function - already handled by frontend
|
||||||
default:
|
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
|
// that cse works on their addresses
|
||||||
return s.newValue1A(ssa.OpAddr, t, n, s.sp)
|
return s.newValue1A(ssa.OpAddr, t, n, s.sp)
|
||||||
default:
|
default:
|
||||||
s.Fatalf("variable address class %v not implemented", classnames[n.Class()])
|
s.Fatalf("variable address class %v not implemented", n.Class())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case OINDREGSP:
|
case OINDREGSP:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue