cmd/5g etc: merge simple case expressions onto fewer lines

The c2go translation left a lot of case expressions on separate lines.
Merge expressions onto single lines subject to these constraints:

* Max 4 clauses, all literals or names
* Don't move expressions with comments

The change was created by running http://play.golang.org/p/yHajs72h-g:

$ mergecase cmd/internal/{ld,gc,obj}/*.go cmd/internal/obj/*/*.go

Passes toolstash -cmp.

Change-Id: Iba41b390d302e5486e5dc6ba7599a92270676556
Reviewed-on: https://go-review.googlesource.com/7593
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Josh Bleecher Snyder 2015-04-01 09:38:44 -07:00
parent 2c20eda1d8
commit b09925b31d
45 changed files with 358 additions and 851 deletions

View file

@ -172,8 +172,7 @@ func Cgen(n *Node, res *Node) {
// can't do in walk because n->left->addable
// changes if n->left is an escaping local variable.
switch n.Op {
case OSPTR,
OLEN:
case OSPTR, OLEN:
if Isslice(n.Left.Type) || Istype(n.Left.Type, TSTRING) {
n.Addable = n.Left.Addable
}
@ -665,9 +664,7 @@ func Cgen(n *Node, res *Node) {
}
}
case OLSH,
ORSH,
OLROT:
case OLSH, ORSH, OLROT:
Thearch.Cgen_shift(int(n.Op), n.Bounded, nl, nr, res)
}
@ -1569,9 +1566,7 @@ func Igen(n *Node, a *Node, res *Node) {
Fixlargeoffset(a)
return
case OCALLFUNC,
OCALLMETH,
OCALLINTER:
case OCALLFUNC, OCALLMETH, OCALLINTER:
switch n.Op {
case OCALLFUNC:
cgen_call(n, 0)