mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: rewrite code to omit many nodeSeq calls
This CL was automatically generated using a special-purpose AST rewriting tool, followed by manual editing to put some comments back in the right places and fix some bad line breaks. The result is not perfect but it's a big step toward getting back to sanity, and because it was automatically generated there is a decent chance that it is correct. Passes toolstash -cmp. Update #14473. Change-Id: I01c09078a6d78e2b008bc304d744b79469a38d3d Reviewed-on: https://go-review.googlesource.com/20440 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
db506fe98c
commit
38921b36ba
25 changed files with 794 additions and 811 deletions
|
|
@ -429,6 +429,26 @@ func (n *Nodes) Slice() []*Node {
|
|||
return *n.slice
|
||||
}
|
||||
|
||||
// Len returns the number of entries in Nodes.
|
||||
func (n *Nodes) Len() int {
|
||||
if n.slice == nil {
|
||||
return 0
|
||||
}
|
||||
return len(*n.slice)
|
||||
}
|
||||
|
||||
// First returns the first element of Nodes.
|
||||
// It panics if Nodes has no elements.
|
||||
func (n *Nodes) First() *Node {
|
||||
return (*n.slice)[0]
|
||||
}
|
||||
|
||||
// Second returns the second element of Nodes.
|
||||
// It panics if Nodes has fewer than two elements.
|
||||
func (n *Nodes) Second() *Node {
|
||||
return (*n.slice)[1]
|
||||
}
|
||||
|
||||
// NodeList returns the entries in Nodes as a NodeList.
|
||||
// Changes to the NodeList entries (as in l.N = n) will *not* be
|
||||
// reflected in the Nodes.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue