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:
Ian Lance Taylor 2016-03-03 20:48:00 -08:00
parent 1765863e57
commit 132ebeac3f
7 changed files with 247 additions and 249 deletions

View file

@ -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")
}