mirror of
https://github.com/golang/go
synced 2024-11-24 08:50:14 -07:00
cmd/compile: simplify as2 method of *Order
Merge the two for loops that set up the node lists for temporaries into one for loop. Passes toolstash -cmp Change-Id: Ibc739115f38c8869b0dcfbf9819fdc2fc96962e0 Reviewed-on: https://go-review.googlesource.com/c/141819 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9322b53396
commit
d6e80069f3
@ -1253,9 +1253,10 @@ func okas(ok, val *Node) *Node {
|
|||||||
func (o *Order) as2(n *Node) {
|
func (o *Order) as2(n *Node) {
|
||||||
tmplist := []*Node{}
|
tmplist := []*Node{}
|
||||||
left := []*Node{}
|
left := []*Node{}
|
||||||
for _, l := range n.List.Slice() {
|
for ni, l := range n.List.Slice() {
|
||||||
if !l.isBlank() {
|
if !l.isBlank() {
|
||||||
tmp := o.newTemp(l.Type, types.Haspointers(l.Type))
|
tmp := o.newTemp(l.Type, types.Haspointers(l.Type))
|
||||||
|
n.List.SetIndex(ni, tmp)
|
||||||
tmplist = append(tmplist, tmp)
|
tmplist = append(tmplist, tmp)
|
||||||
left = append(left, l)
|
left = append(left, l)
|
||||||
}
|
}
|
||||||
@ -1268,14 +1269,6 @@ func (o *Order) as2(n *Node) {
|
|||||||
as.Rlist.Set(tmplist)
|
as.Rlist.Set(tmplist)
|
||||||
as = typecheck(as, Etop)
|
as = typecheck(as, Etop)
|
||||||
o.stmt(as)
|
o.stmt(as)
|
||||||
|
|
||||||
ti := 0
|
|
||||||
for ni, l := range n.List.Slice() {
|
|
||||||
if !l.isBlank() {
|
|
||||||
n.List.SetIndex(ni, tmplist[ti])
|
|
||||||
ti++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// okAs2 orders OAS2 with ok.
|
// okAs2 orders OAS2 with ok.
|
||||||
|
Loading…
Reference in New Issue
Block a user