diff options
| author | Russ Cox <rsc@golang.org> | 2009-05-20 14:24:23 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2009-05-20 14:24:23 -0700 |
| commit | 9f1b2a06b12b5f6be34668a006219c772b7e76db (patch) | |
| tree | fd66f5244de635209da5f609c2b045a6ac1dc2be /src/cmd | |
| parent | 210db235ff6ad1339b2726bdb2d038865ca84b9e (diff) | |
| download | golang-9f1b2a06b12b5f6be34668a006219c772b7e76db.tar.gz | |
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
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/gc/walk.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 34d29e0a1..3013faf19 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -114,7 +114,8 @@ loop: return; more = N; - lineno = n->lineno; + if(n->op != ONAME) + lineno = n->lineno; switch(n->op) { case OLIST: @@ -123,7 +124,10 @@ loop: break; default: - yyerror("walkstate: %O not a top level statement", n->op); + 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); case OASOP: case OAS: @@ -3355,11 +3359,7 @@ dorange(Node *nn) if(nn->op != ORANGE) fatal("dorange not ORANGE"); - implicitstar(&nn->right); k = nn->left; - m = nn->right; - local = nn->etype; - v = N; if(k->op == OLIST) { v = k->right; @@ -3368,7 +3368,11 @@ dorange(Node *nn) n = nod(OFOR, N, N); - walktype(m, Erv); + walktype(nn->right, Erv); + implicitstar(&nn->right); + m = nn->right; + local = nn->etype; + t = m->type; if(t == T) goto out; |
