diff options
author | Ingo Oeser <ingo@jimdo.com> | 2013-06-14 23:22:50 +0200 |
---|---|---|
committer | Ingo Oeser <ingo@jimdo.com> | 2013-06-14 23:22:50 +0200 |
commit | 09f84a75bc63a6316d575f531489d69ec8ade2e8 (patch) | |
tree | b74a4dcecf087639a6898acb55c71dae1e54b299 /src/cmd/gc/sinit.c | |
parent | efcc50dfdc94c82ee0292bf71992ecb7c0123061 (diff) | |
download | golang-upstream/1.1.1.tar.gz |
Imported Upstream version 1.1.1upstream/1.1.1
Diffstat (limited to 'src/cmd/gc/sinit.c')
-rw-r--r-- | src/cmd/gc/sinit.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/gc/sinit.c b/src/cmd/gc/sinit.c index f8c61828c..51c5f7022 100644 --- a/src/cmd/gc/sinit.c +++ b/src/cmd/gc/sinit.c @@ -50,9 +50,10 @@ init1(Node *n, NodeList **out) case PFUNC: break; default: - if(isblank(n) && n->defn != N && n->defn->initorder == InitNotStarted) { - n->defn->initorder = InitDone; - *out = list(*out, n->defn); + if(isblank(n) && n->curfn == N && n->defn != N && n->defn->initorder == InitNotStarted) { + // blank names initialization is part of init() but not + // when they are inside a function. + break; } return; } @@ -62,7 +63,7 @@ init1(Node *n, NodeList **out) if(n->initorder == InitPending) { if(n->class == PFUNC) return; - + // if there have already been errors printed, // those errors probably confused us and // there might not be a loop. let the user @@ -127,8 +128,8 @@ init1(Node *n, NodeList **out) init2(n->defn->right, out); if(debug['j']) print("%S\n", n->sym); - if(!staticinit(n, out)) { -if(debug['%']) dump("nonstatic", n->defn); + if(isblank(n) || !staticinit(n, out)) { + if(debug['%']) dump("nonstatic", n->defn); *out = list(*out, n->defn); } } else if(0) { @@ -149,6 +150,7 @@ if(debug['%']) dump("nonstatic", n->defn); n->defn->initorder = InitDone; for(l=n->defn->rlist; l; l=l->next) init1(l->n, out); + if(debug['%']) dump("nonstatic", n->defn); *out = list(*out, n->defn); break; } |