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

@ -17,7 +17,7 @@ func Rnd(o int64, r int64) int64 {
func offmod(t *Type) {
o := int32(0)
for f, it := IterFields(t); f != nil; f = it.Next() {
for _, f := range t.Fields().Slice() {
f.Width = int64(o)
o += int32(Widthptr)
if int64(o) >= Thearch.MAXWIDTH {
@ -35,7 +35,7 @@ func widstruct(errtype *Type, t *Type, o int64, flag int) int64 {
}
lastzero := int64(0)
var w int64
for f, it := IterFields(t); f != nil; f = it.Next() {
for _, f := range t.Fields().Slice() {
if f.Type == nil {
// broken field, just skip it so that other valid fields
// get a width.
@ -387,7 +387,7 @@ func Argsize(t *Type) int {
var w int64
for _, p := range recvsParamsResults {
for f, it := IterFields(p(t)); f != nil; f = it.Next() {
for _, f := range p(t).Fields().Slice() {
if x := f.Width + f.Type.Width; x > w {
w = x
}