From: Ken Thompson Date: Tue, 4 May 2010 05:51:30 +0000 (-0700) Subject: allow data statements for simple X-Git-Tag: weekly.2010-05-04~2 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a3a0a5fdc3bc2debdc5fda4c11fc013076795df4;p=gostls13.git allow data statements for simple external variable assignements. R=rsc CC=golang-dev https://golang.org/cl/1094041 --- diff --git a/src/cmd/gc/init.c b/src/cmd/gc/init.c index a89c0181fa..cdd462e55e 100644 --- a/src/cmd/gc/init.c +++ b/src/cmd/gc/init.c @@ -37,17 +37,14 @@ renameinit(Node *n) * return * throw(); (5) * } - * initdone. += 1; (6) + * initdone. = 1; (6) * // over all matching imported symbols * .init·() (7) * { } (8) * init·() // if any (9) - * initdone. += 1; (10) + * initdone. = 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 a79c75131f..86e45e12d3 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: