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>
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 69c8390..4e3079f 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -1788,7 +1788,7 @@
// helpers for shape errors
func dumptypes(nl *Type, what string) string {
s := ""
- for l, it := IterFields(nl); l != nil; l = it.Next() {
+ for _, l := range nl.Fields().Slice() {
if s != "" {
s += ", "
}
@@ -1842,7 +1842,7 @@
// copy into temporaries.
var alist []*Node
- for l, it := IterFields(r.Type); l != nil; l = it.Next() {
+ for _, l := range r.Type.Fields().Slice() {
tmp := temp(l.Type)
alist = append(alist, tmp)
}
@@ -2560,7 +2560,7 @@
// stack memory addresses.
func paramstoheap(params *Type, out bool) []*Node {
var nn []*Node
- for t, it := IterFields(params); t != nil; t = it.Next() {
+ for _, t := range params.Fields().Slice() {
v := t.Nname
if v != nil && v.Sym != nil && strings.HasPrefix(v.Sym.Name, "~r") { // unnamed result
v = nil
@@ -2603,7 +2603,7 @@
// back to the stack.
func returnsfromheap(params *Type) []*Node {
var nn []*Node
- for t, it := IterFields(params); t != nil; t = it.Next() {
+ for _, t := range params.Fields().Slice() {
v := t.Nname
if v == nil || v.Class != PHEAP|PPARAMOUT {
continue
@@ -3223,7 +3223,7 @@
// Inline comparisons.
var li *Node
var ri *Node
- for t1, it := IterFields(t); t1 != nil; t1 = it.Next() {
+ for _, t1 := range t.Fields().Slice() {
if isblanksym(t1.Sym) {
continue
}