mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
e0111bb0f4
commit
bb45bc27b5
5 changed files with 58 additions and 68 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue