diff options
author | Russ Cox <rsc@golang.org> | 2010-06-12 11:17:24 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-06-12 11:17:24 -0700 |
commit | 171e56e8ce55c0937e4f4fe0487c0e69ddac2f74 (patch) | |
tree | 791790d4d7d3f5aabc0cf1235a9ff2a4e40c0e66 /src/cmd/gc/subr.c | |
parent | 5cc45168f9d5aa01db50aa19ce69e39fc4967541 (diff) | |
download | golang-171e56e8ce55c0937e4f4fe0487c0e69ddac2f74.tar.gz |
gc: less aggressive name binding, for better line numbers in errors
Cleans up a few other corner cases too.
R=ken2
CC=golang-dev
http://codereview.appspot.com/1592045
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r-- | src/cmd/gc/subr.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index 649b8f542..c836b60f2 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1529,13 +1529,19 @@ treecopy(Node *n) break; case ONONAME: - if(n->iota) { - m = nod(OIOTA, n, nodintconst(iota)); + if(n->sym == lookup("iota")) { + // Not sure yet whether this is the real iota, + // but make a copy of the Node* just in case, + // so that all the copies of this const definition + // don't have the same iota value. + m = nod(OXXX, N, N); + *m = *n; + m->iota = iota; break; } // fall through - case OLITERAL: case ONAME: + case OLITERAL: case OTYPE: m = n; break; |