cmd/compile: more nodeSeq conversions

Found by temporarily flipping fields from *NodeList to Nodes and fixing
all the compilation errors.  This CL does not actually change any
fields.

Passes toolstash -cmp.

Update #14473.

Change-Id: Ib98fa37e8752f96358224c973a743618a6a0e736
Reviewed-on: https://go-review.googlesource.com/20320
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-03-07 09:36:24 -08:00
parent c3dfad5df9
commit 2a68c6c27c
15 changed files with 234 additions and 229 deletions

View file

@ -587,7 +587,8 @@ func (ni *nodesIterator) Seq() nodesOrNodeList {
return r
}
// nodeSeqIterate returns an iterator over a *NodeList, a Nodes, or a []*Node.
// nodeSeqIterate returns an iterator over a *NodeList, a Nodes,
// a []*Node, or nil.
func nodeSeqIterate(ns nodesOrNodeList) nodeSeqIterator {
switch ns := ns.(type) {
case *NodeList:
@ -598,12 +599,15 @@ func nodeSeqIterate(ns nodesOrNodeList) nodeSeqIterator {
var r Nodes
r.Set(ns)
return &nodesIterator{r, 0}
case nil:
var r Nodes
return &nodesIterator{r, 0}
default:
panic("can't happen")
}
}
// nodeSeqLen returns the length of a *NodeList, a Nodes, or a []*Node.
// nodeSeqLen returns the length of a *NodeList, a Nodes, a []*Node, or nil.
func nodeSeqLen(ns nodesOrNodeList) int {
switch ns := ns.(type) {
case *NodeList:
@ -612,6 +616,8 @@ func nodeSeqLen(ns nodesOrNodeList) int {
return len(ns.Slice())
case []*Node:
return len(ns)
case nil:
return 0
default:
panic("can't happen")
}