cmd/compile: replace opnames with stringer

Now possible, since stringer just got the -trimprefix flag added.

While at it, simplify a few Op stringifications since we can now use %v,
and no longer have to worry about o<len(opnames).

Passes toolstash -cmp on std cmd.

Fixes #15462.

Change-Id: Icdcde0b0a5eb165d18488918175024da274f782b
Reviewed-on: https://go-review.googlesource.com/76790
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
Daniel Martí 2017-11-09 23:10:43 +00:00
parent 366681cc06
commit 3231d4e4ef
7 changed files with 25 additions and 172 deletions

View file

@ -496,11 +496,13 @@ func (f *Func) setWBPos(pos src.XPos) {
}
}
//go:generate stringer -type=Op -trimprefix=O
type Op uint8
// Node ops.
const (
OXXX = Op(iota)
OXXX Op = iota
// names
ONAME // var, const or func name