Commit 47e51527 authored by Russ Cox's avatar Russ Cox

fix implicit star for range on *map, *[].

do not update lineno from ONAME nodes,
	because they have declaration lineno not use.
show actual name in top-level statement error.

before
runtime.a:7: x.go:5: walkstate: NAME not a top level statement

after
x.go:14: walkstate: runtime.Goexit not a top level statement

R=ken
OCL=29113
CL=29116
parent 04d8605c
...@@ -114,6 +114,7 @@ loop: ...@@ -114,6 +114,7 @@ loop:
return; return;
more = N; more = N;
if(n->op != ONAME)
lineno = n->lineno; lineno = n->lineno;
switch(n->op) { switch(n->op) {
...@@ -123,6 +124,9 @@ loop: ...@@ -123,6 +124,9 @@ loop:
break; break;
default: default:
if(n->op == ONAME)
yyerror("walkstate: %S not a top level statement", n->sym);
else
yyerror("walkstate: %O not a top level statement", n->op); yyerror("walkstate: %O not a top level statement", n->op);
case OASOP: case OASOP:
...@@ -3355,11 +3359,7 @@ dorange(Node *nn) ...@@ -3355,11 +3359,7 @@ dorange(Node *nn)
if(nn->op != ORANGE) if(nn->op != ORANGE)
fatal("dorange not ORANGE"); fatal("dorange not ORANGE");
implicitstar(&nn->right);
k = nn->left; k = nn->left;
m = nn->right;
local = nn->etype;
v = N; v = N;
if(k->op == OLIST) { if(k->op == OLIST) {
v = k->right; v = k->right;
...@@ -3368,7 +3368,11 @@ dorange(Node *nn) ...@@ -3368,7 +3368,11 @@ dorange(Node *nn)
n = nod(OFOR, N, N); n = nod(OFOR, N, N);
walktype(m, Erv); walktype(nn->right, Erv);
implicitstar(&nn->right);
m = nn->right;
local = nn->etype;
t = m->type; t = m->type;
if(t == T) if(t == T)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment