mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: eliminate a bunch of IterFields/IterMethods calls
This is an automated rewrite of all the calls of the form:
for f, it := IterFields(t); f != nil; f = it.Next() { ... }
Followup CLs will work on cleaning up the remaining cases.
Change-Id: Ic1005ad45ae0b50c63e815e34e507e2d2644ba1a
Reviewed-on: https://go-review.googlesource.com/20794
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
517b6131b2
commit
f6bca3f32d
17 changed files with 69 additions and 76 deletions
|
|
@ -1386,7 +1386,7 @@ func initEscretval(e *EscState, n *Node, fntype *Type) {
|
|||
i := 0
|
||||
nE := e.nodeEscState(n)
|
||||
nE.Escretval.Set(nil) // Suspect this is not nil for indirect calls.
|
||||
for t, it := IterFields(fntype.Results()); t != nil; t = it.Next() {
|
||||
for _, t := range fntype.Results().Fields().Slice() {
|
||||
src := Nod(ONAME, nil, nil)
|
||||
buf := fmt.Sprintf(".out%d", i)
|
||||
i++
|
||||
|
|
@ -1967,7 +1967,7 @@ func esctag(e *EscState, func_ *Node) {
|
|||
// unless //go:noescape is given before the declaration.
|
||||
if len(func_.Nbody.Slice()) == 0 {
|
||||
if func_.Noescape {
|
||||
for t, it := IterFields(func_.Type.Params()); t != nil; t = it.Next() {
|
||||
for _, t := range func_.Type.Params().Fields().Slice() {
|
||||
if haspointers(t.Type) {
|
||||
t.Note = mktag(EscNone)
|
||||
}
|
||||
|
|
@ -1981,7 +1981,7 @@ func esctag(e *EscState, func_ *Node) {
|
|||
// but we are reusing the ability to annotate an individual function
|
||||
// argument and pass those annotations along to importing code.
|
||||
narg := 0
|
||||
for t, it := IterFields(func_.Type.Params()); t != nil; t = it.Next() {
|
||||
for _, t := range func_.Type.Params().Fields().Slice() {
|
||||
narg++
|
||||
if t.Type.Etype == TUINTPTR {
|
||||
if Debug['m'] != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue