diff options
author | Ken Thompson <ken@golang.org> | 2010-05-03 22:51:30 -0700 |
---|---|---|
committer | Ken Thompson <ken@golang.org> | 2010-05-03 22:51:30 -0700 |
commit | 3dab695eca135903c6dac81b8cea5d9527f8169a (patch) | |
tree | c3f781697a25ed7c17deaaf1708c1028ade4fa20 /src | |
parent | 8100a94c4a2b2bf1ac99d13aaaf5d6fcaa663d32 (diff) | |
download | golang-3dab695eca135903c6dac81b8cea5d9527f8169a.tar.gz |
allow data statements for simple
external variable assignements.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1094041
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/gc/init.c | 8 | ||||
-rw-r--r-- | src/cmd/gc/walk.c | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/cmd/gc/init.c b/src/cmd/gc/init.c index a89c0181f..cdd462e55 100644 --- a/src/cmd/gc/init.c +++ b/src/cmd/gc/init.c @@ -37,17 +37,14 @@ renameinit(Node *n) * return * throw(); (5) * } - * initdone.<file> += 1; (6) + * initdone.<file> = 1; (6) * // over all matching imported symbols * <pkg>.init·<file>() (7) * { <init stmts> } (8) * init·<file>() // if any (9) - * initdone.<file> += 1; (10) + * initdone.<file> = 2; (10) * return (11) * } - * note that this code cannot have an assignment - * statement or, because of the initflag, it will - * be converted into a data statement. */ int anyinit(NodeList *n) @@ -120,7 +117,6 @@ fninit(NodeList *n) addvar(gatevar, types[TUINT8], PEXTERN); // (2) - maxarg = 0; snprint(namebuf, sizeof(namebuf), "Init·"); diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index a79c75131..86e45e12d 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -701,8 +701,10 @@ walkexpr(Node **np, NodeList **init) if(l == N || r == N) goto ret; r = ascompatee1(n->op, l, r, init); - if(r != N) + if(r != N) { + r->dodata = n->dodata; n = r; + } goto ret; case OAS2: |