summaryrefslogtreecommitdiff
path: root/src/cmd/gc/dcl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/dcl.c')
-rw-r--r--src/cmd/gc/dcl.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index 8e790ef08..335d056a0 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -188,6 +188,7 @@ declare(Node *n, int ctxt)
else if(n->op == ONAME)
gen = ++vargen;
pushdcl(s);
+ n->curfn = curfn;
}
if(ctxt == PAUTO)
n->xoffset = BADWIDTH;
@@ -437,20 +438,6 @@ newtype(Sym *s)
return t;
}
-/*
- * type check top level declarations
- */
-void
-dclchecks(void)
-{
- NodeList *l;
-
- for(l=externdcl; l; l=l->next) {
- if(l->n->op != ONAME)
- continue;
- typecheck(&l->n, Erv);
- }
-}
/*
* := declarations
@@ -524,6 +511,30 @@ colas(NodeList *left, NodeList *right)
}
/*
+ * declare the arguments in an
+ * interface field declaration.
+ */
+void
+ifacedcl(Node *n)
+{
+ if(n->op != ODCLFIELD || n->right == N)
+ fatal("ifacedcl");
+
+ dclcontext = PAUTO;
+ markdcl();
+ funcdepth++;
+ n->outer = curfn;
+ curfn = n;
+ funcargs(n->right);
+
+ // funcbody is normally called after the parser has
+ // seen the body of a function but since an interface
+ // field declaration does not have a body, we must
+ // call it now to pop the current declaration context.
+ funcbody(n);
+}
+
+/*
* declare the function proper
* and declare the arguments.
* called in extern-declaration context
@@ -1226,9 +1237,6 @@ funccompile(Node *n, int isclosure)
if(curfn)
fatal("funccompile %S inside %S", n->nname->sym, curfn->nname->sym);
- curfn = n;
- typechecklist(n->nbody, Etop);
- curfn = nil;
stksize = 0;
dclcontext = PAUTO;