cmd/compile: add Nodes.Set1 method and use it where possible

Passes toolstash -cmp.

Change-Id: I05322fb5afd213f13fb247ec1a5f655c17a58774
Reviewed-on: https://go-review.googlesource.com/20522
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-03-10 10:13:42 -08:00
parent 72655afb4e
commit c63dbd87c1
15 changed files with 63 additions and 54 deletions

View file

@ -411,6 +411,11 @@ func (n *Nodes) Set(s []*Node) {
}
}
// Set1 sets n to a slice containing a single node.
func (n *Nodes) Set1(node *Node) {
n.slice = &[]*Node{node}
}
// MoveNodes sets n to the contents of n2, then clears n2.
func (n *Nodes) MoveNodes(n2 *Nodes) {
n.slice = n2.slice