mirror of
https://github.com/golang/go.git
synced 2025-11-10 21:51:05 +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
|
|
@ -110,7 +110,7 @@ func caninl(fn *Node) {
|
|||
|
||||
// can't handle ... args yet
|
||||
if Debug['l'] < 3 {
|
||||
for t, it := IterFields(fn.Type.Params()); t != nil; t = it.Next() {
|
||||
for _, t := range fn.Type.Params().Fields().Slice() {
|
||||
if t.Isddd {
|
||||
return
|
||||
}
|
||||
|
|
@ -576,7 +576,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
|
|||
|
||||
// temporaries for return values.
|
||||
var m *Node
|
||||
for t, it := IterFields(fn.Type.Results()); t != nil; t = it.Next() {
|
||||
for _, t := range fn.Type.Results().Fields().Slice() {
|
||||
if t != nil && t.Nname != nil && !isblank(t.Nname) {
|
||||
m = inlvar(t.Nname)
|
||||
typecheck(&m, Erv)
|
||||
|
|
@ -617,7 +617,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
|
|||
|
||||
var varargtype *Type
|
||||
varargcount := 0
|
||||
for t, it := IterFields(fn.Type.Params()); t != nil; t = it.Next() {
|
||||
for _, t := range fn.Type.Params().Fields().Slice() {
|
||||
if t.Isddd {
|
||||
variadic = true
|
||||
varargtype = t.Type
|
||||
|
|
@ -683,7 +683,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
|
|||
if !chkargcount {
|
||||
// 0 or 1 expression on RHS.
|
||||
var i int
|
||||
for t, it2 := IterFields(fn.Type.Params()); t != nil; t = it2.Next() {
|
||||
for _, t := range fn.Type.Params().Fields().Slice() {
|
||||
if variadic && t.Isddd {
|
||||
vararg = tinlvar(t)
|
||||
for i = 0; i < varargcount && li < n.List.Len(); i++ {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue