mirror of https://github.com/golang/go.git
parent
6470379395
commit
5ebf615db5
|
|
@ -363,9 +363,8 @@ func (s *state) walkRange(dot reflect.Value, r *parse.RangeNode) {
|
|||
oneIteration := func(index, elem reflect.Value) {
|
||||
if len(r.Pipe.Decl) > 0 {
|
||||
if r.Pipe.IsAssign {
|
||||
// With two variables index comes first in all cases.
|
||||
// With one variable, we use the element for most cases,
|
||||
// but not for range over a function.
|
||||
// With two variables, index comes first.
|
||||
// With one, we use the element.
|
||||
if len(r.Pipe.Decl) > 1 {
|
||||
s.setVar(r.Pipe.Decl[0].Ident[0], index)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue