mirror of https://github.com/golang/go.git
cmd/gc: fix range typecheck order
Typecheck for range variables before typechecking for range body. Body can refer to new vars declared in for range, so it is preferable to typecheck them before the body. Makes typecheck order consistent between ORANGE and OFOR. This come up during another change that computes some predicates on variables during typechecking. Change-Id: Ic975db61b1fd5b7f9ee78896d4cc7d93c593c532 Reviewed-on: https://go-review.googlesource.com/3284 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
d94192180f
commit
9a36beb2af
|
|
@ -98,13 +98,13 @@ typecheckrange(Node *n)
|
|||
}
|
||||
|
||||
out:
|
||||
typechecklist(n->nbody, Etop);
|
||||
|
||||
// second half of dance
|
||||
n->typecheck = 1;
|
||||
for(ll=n->list; ll; ll=ll->next)
|
||||
if(ll->n->typecheck == 0)
|
||||
typecheck(&ll->n, Erv | Easgn);
|
||||
|
||||
typechecklist(n->nbody, Etop);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in New Issue