mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
ca5417b8e0
commit
bd83cc6dae
5 changed files with 13 additions and 17 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue