in typecheck and walk, conversion from OAS2RECV to OAS2
and to OSELRECV2 duplicated the ->rlist->n to ->right
thereby destroying the strict tree-ness of the AST (up to
ONAMES) of course. Several recursions in esc.c and inl.c
and probably elsewhere assume nodes of the tree aren't duplicated.
rather than defensively code around this, i'd rather assert
these cases away and fix their cause.
(this was tripped in
6741044)
R=rsc
CC=golang-dev
https://golang.org/cl/
6750043
case OAS2RECV:
// convert x, ok = <-c into OSELRECV2(x, <-c) with ntest=ok
- if(n->right->op != ORECV) {
+ if(n->rlist->n->op != ORECV) {
yyerror("select assignment must have receive on right hand side");
break;
}
n->left = n->list->n;
n->ntest = n->list->next->n;
n->right = n->rlist->n;
+ n->rlist = nil;
break;
case ORECV:
a = nod(OAS2, N, N);
a->list = n->list;
- a->rlist = n->rlist;
+ a->rlist = list1(n->right);
n = a;
typecheck(&n, Etop);
break;
goto common;
case ORECV:
n->op = OAS2RECV;
- n->right = n->rlist->n;
goto common;
case ODOTTYPE:
n->op = OAS2DOTTYPE;