cmd/compile: prettify loop iterations

This commit replaces some of

for i := len(x) - 1; i >= 0; i-- {...}

style loops, which do not rely on reverse iteration order.

Change-Id: I5542834286562da058200c06e7a173b13760e54d
Reviewed-on: https://go-review.googlesource.com/21044
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Marvin Stenger 2016-03-23 16:35:50 +01:00 committed by Brad Fitzpatrick
parent ca5417b8e0
commit bd83cc6dae
5 changed files with 13 additions and 17 deletions

View file

@ -455,15 +455,15 @@ func escAnalyze(all []*Node, recursive bool) {
e.nodeEscState(&e.theSink).Escloopdepth = -1
e.recursive = recursive
for i := len(all) - 1; i >= 0; i-- {
if n := all[i]; n.Op == ODCLFUNC {
for _, n := range all {
if n.Op == ODCLFUNC {
n.Esc = EscFuncPlanned
}
}
// flow-analyze functions
for i := len(all) - 1; i >= 0; i-- {
if n := all[i]; n.Op == ODCLFUNC {
for _, n := range all {
if n.Op == ODCLFUNC {
escfunc(e, n)
}
}
@ -477,8 +477,8 @@ func escAnalyze(all []*Node, recursive bool) {
}
// for all top level functions, tag the typenodes corresponding to the param nodes
for i := len(all) - 1; i >= 0; i-- {
if n := all[i]; n.Op == ODCLFUNC {
for _, n := range all {
if n.Op == ODCLFUNC {
esctag(e, n)
}
}