cmd/compile: make more use of value switches

Use them to replace if/else chains with at least three comparisons,
where the code becomes clearly simpler.

Passes toolstash -cmp on std cmd.

Change-Id: Ic98aa3905944ddcab5aef5f9d9ba376853263d94
Reviewed-on: https://go-review.googlesource.com/70934
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Daniel Martí 2017-10-15 22:49:52 +01:00 committed by Emmanuel Odeke
parent e0111bb0f4
commit bb45bc27b5
5 changed files with 58 additions and 68 deletions

View file

@ -213,10 +213,10 @@ func init2(n *Node, out *[]*Node) {
init2list(n.Rlist, out)
init2list(n.Nbody, out)
if n.Op == OCLOSURE {
switch n.Op {
case OCLOSURE:
init2list(n.Func.Closure.Nbody, out)
}
if n.Op == ODOTMETH || n.Op == OCALLPART {
case ODOTMETH, OCALLPART:
init2(asNode(n.Type.FuncType().Nname), out)
}
}