summaryrefslogtreecommitdiff
path: root/src/cmd/gc
diff options
context:
space:
mode:
authorIngo Oeser <ingo@jimdo.com>2013-06-14 23:22:50 +0200
committerIngo Oeser <ingo@jimdo.com>2013-06-14 23:22:50 +0200
commit09f84a75bc63a6316d575f531489d69ec8ade2e8 (patch)
treeb74a4dcecf087639a6898acb55c71dae1e54b299 /src/cmd/gc
parentefcc50dfdc94c82ee0292bf71992ecb7c0123061 (diff)
downloadgolang-upstream/1.1.1.tar.gz
Imported Upstream version 1.1.1upstream/1.1.1
Diffstat (limited to 'src/cmd/gc')
-rw-r--r--src/cmd/gc/export.c6
-rw-r--r--src/cmd/gc/go.h1
-rw-r--r--src/cmd/gc/inl.c5
-rw-r--r--src/cmd/gc/sinit.c14
4 files changed, 17 insertions, 9 deletions
diff --git a/src/cmd/gc/export.c b/src/cmd/gc/export.c
index b7311665a..4a9b8c8ba 100644
--- a/src/cmd/gc/export.c
+++ b/src/cmd/gc/export.c
@@ -164,13 +164,17 @@ reexportdep(Node *n)
case ODOTTYPE:
case ODOTTYPE2:
case OSTRUCTLIT:
+ case OARRAYLIT:
case OPTRLIT:
+ case OMAKEMAP:
+ case OMAKESLICE:
+ case OMAKECHAN:
t = n->type;
if(!t->sym && t->type)
t = t->type;
if(t && t->sym && t->sym->def && !exportedsym(t->sym)) {
if(debug['E'])
- print("reexport type for convnop %S\n", t->sym);
+ print("reexport type for expression %S\n", t->sym);
exportlist = list(exportlist, t->sym->def);
}
break;
diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h
index 48bcf0233..e94eb90ee 100644
--- a/src/cmd/gc/go.h
+++ b/src/cmd/gc/go.h
@@ -282,6 +282,7 @@ struct Node
NodeList* cvars; // closure params
NodeList* dcl; // autodcl for this func/closure
NodeList* inl; // copy of the body for use in inlining
+ NodeList* inldcl; // copy of dcl for use in inlining
// OLITERAL/OREGISTER
Val val;
diff --git a/src/cmd/gc/inl.c b/src/cmd/gc/inl.c
index f77b51d70..08b462e13 100644
--- a/src/cmd/gc/inl.c
+++ b/src/cmd/gc/inl.c
@@ -146,6 +146,7 @@ caninl(Node *fn)
fn->nname->inl = fn->nbody;
fn->nbody = inlcopylist(fn->nname->inl);
+ fn->nname->inldcl = inlcopylist(fn->nname->defn->dcl);
// hack, TODO, check for better way to link method nodes back to the thing with the ->inl
// this is so export can find the body of a method
@@ -558,8 +559,8 @@ mkinlcall1(Node **np, Node *fn, int isddd)
//dumplist("ninit pre", ninit);
- if (fn->defn) // local function
- dcl = fn->defn->dcl;
+ if(fn->defn) // local function
+ dcl = fn->inldcl;
else // imported function
dcl = fn->dcl;
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;
}