mirror of
https://github.com/golang/go
synced 2024-11-22 03:04:41 -07:00
allow data statements for simple
external variable assignements. R=rsc CC=golang-dev https://golang.org/cl/1094041
This commit is contained in:
parent
b9caa4ac56
commit
a3a0a5fdc3
@ -37,17 +37,14 @@ renameinit(Node *n)
|
|||||||
* return
|
* return
|
||||||
* throw(); (5)
|
* throw(); (5)
|
||||||
* }
|
* }
|
||||||
* initdone.<file> += 1; (6)
|
* initdone.<file> = 1; (6)
|
||||||
* // over all matching imported symbols
|
* // over all matching imported symbols
|
||||||
* <pkg>.init·<file>() (7)
|
* <pkg>.init·<file>() (7)
|
||||||
* { <init stmts> } (8)
|
* { <init stmts> } (8)
|
||||||
* init·<file>() // if any (9)
|
* init·<file>() // if any (9)
|
||||||
* initdone.<file> += 1; (10)
|
* initdone.<file> = 2; (10)
|
||||||
* return (11)
|
* 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
|
int
|
||||||
anyinit(NodeList *n)
|
anyinit(NodeList *n)
|
||||||
@ -120,7 +117,6 @@ fninit(NodeList *n)
|
|||||||
addvar(gatevar, types[TUINT8], PEXTERN);
|
addvar(gatevar, types[TUINT8], PEXTERN);
|
||||||
|
|
||||||
// (2)
|
// (2)
|
||||||
|
|
||||||
maxarg = 0;
|
maxarg = 0;
|
||||||
snprint(namebuf, sizeof(namebuf), "Init·");
|
snprint(namebuf, sizeof(namebuf), "Init·");
|
||||||
|
|
||||||
|
@ -701,8 +701,10 @@ walkexpr(Node **np, NodeList **init)
|
|||||||
if(l == N || r == N)
|
if(l == N || r == N)
|
||||||
goto ret;
|
goto ret;
|
||||||
r = ascompatee1(n->op, l, r, init);
|
r = ascompatee1(n->op, l, r, init);
|
||||||
if(r != N)
|
if(r != N) {
|
||||||
|
r->dodata = n->dodata;
|
||||||
n = r;
|
n = r;
|
||||||
|
}
|
||||||
goto ret;
|
goto ret;
|
||||||
|
|
||||||
case OAS2:
|
case OAS2:
|
||||||
|
Loading…
Reference in New Issue
Block a user