mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: convert walk.go and friends to use nodeSeq
Pases toolstash -cmp. Update #14473. Change-Id: I450d9f51fd280da91952008cd917b749d88960a3 Reviewed-on: https://go-review.googlesource.com/20210 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
1765863e57
commit
132ebeac3f
7 changed files with 247 additions and 249 deletions
|
|
@ -587,13 +587,17 @@ func (ni *nodesIterator) Seq() nodesOrNodeList {
|
|||
return r
|
||||
}
|
||||
|
||||
// nodeSeqIterate returns an iterator over either a *NodeList or a Nodes.
|
||||
// nodeSeqIterate returns an iterator over a *NodeList, a Nodes, or a []*Node.
|
||||
func nodeSeqIterate(ns nodesOrNodeList) nodeSeqIterator {
|
||||
switch ns := ns.(type) {
|
||||
case *NodeList:
|
||||
return &nodeListIterator{ns}
|
||||
case Nodes:
|
||||
return &nodesIterator{ns, 0}
|
||||
case []*Node:
|
||||
var r Nodes
|
||||
r.Set(ns)
|
||||
return &nodesIterator{r, 0}
|
||||
default:
|
||||
panic("can't happen")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue