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:
Matthew Dempsky 2016-03-17 01:32:18 -07:00
parent 517b6131b2
commit f6bca3f32d
17 changed files with 69 additions and 76 deletions

View file

@ -465,7 +465,7 @@ func (p *exporter) typ(t *Type) {
// TODO(gri) Determine if they are already sorted
// in which case we can drop this step.
var methods []*Field
for m, it := IterMethods(t); m != nil; m = it.Next() {
for _, m := range t.Methods().Slice() {
methods = append(methods, m)
}
sort.Sort(methodbyname(methods))
@ -565,7 +565,7 @@ func (p *exporter) fieldList(t *Type) {
}
p.int(countfield(t))
for f, it := IterFields(t); f != nil; f = it.Next() {
for _, f := range t.Fields().Slice() {
if p.trace {
p.tracef("\n")
}
@ -594,7 +594,7 @@ func (p *exporter) methodList(t *Type) {
}
p.int(countfield(t))
for m, it := IterFields(t); m != nil; m = it.Next() {
for _, m := range t.Fields().Slice() {
if p.trace {
p.tracef("\n")
}
@ -655,7 +655,7 @@ func (p *exporter) paramList(params *Type, numbered bool) {
n = -n
}
p.int(n)
for q, it := IterFields(params); q != nil; q = it.Next() {
for _, q := range params.Fields().Slice() {
p.param(q, n, numbered)
}
}