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
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue