mirror of
https://github.com/golang/go
synced 2024-11-22 03:14:41 -07:00
new
Change-Id: I23ea3f7a59567f00dfb8b58d4bd067230fe94e13
This commit is contained in:
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
Block a user