mirror of
https://github.com/golang/go.git
synced 2025-11-11 22:21:06 +00:00
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:
parent
72655afb4e
commit
c63dbd87c1
15 changed files with 63 additions and 54 deletions
|
|
@ -95,7 +95,7 @@ func typecheckrange(n *Node) {
|
|||
// present."
|
||||
if isblank(v2) {
|
||||
if v1 != nil {
|
||||
n.List.Set([]*Node{v1})
|
||||
n.List.Set1(v1)
|
||||
}
|
||||
v2 = nil
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ func walkrange(n *Node) {
|
|||
tmp.Right.Typecheck = 1
|
||||
a = Nod(OAS, hp, tmp)
|
||||
typecheck(&a, Etop)
|
||||
n.Right.Ninit.Set([]*Node{a})
|
||||
n.Right.Ninit.Set1(a)
|
||||
}
|
||||
|
||||
// orderstmt allocated the iterator for us.
|
||||
|
|
@ -273,8 +273,8 @@ func walkrange(n *Node) {
|
|||
a := Nod(OAS2RECV, nil, nil)
|
||||
a.Typecheck = 1
|
||||
a.List.Set([]*Node{hv1, hb})
|
||||
a.Rlist.Set([]*Node{Nod(ORECV, ha, nil)})
|
||||
n.Left.Ninit.Set([]*Node{a})
|
||||
a.Rlist.Set1(Nod(ORECV, ha, nil))
|
||||
n.Left.Ninit.Set1(a)
|
||||
if v1 == nil {
|
||||
body = nil
|
||||
} else {
|
||||
|
|
@ -299,7 +299,7 @@ func walkrange(n *Node) {
|
|||
a = Nod(OAS2, nil, nil)
|
||||
a.List.Set([]*Node{hv1, hv2})
|
||||
fn := syslook("stringiter2")
|
||||
a.Rlist.Set([]*Node{mkcall1(fn, fn.Type.Results(), nil, ha, hv1)})
|
||||
a.Rlist.Set1(mkcall1(fn, fn.Type.Results(), nil, ha, hv1))
|
||||
}
|
||||
|
||||
n.Left = Nod(ONE, hv1, Nodintconst(0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue