diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-06-30 15:34:22 +0200 | 
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-06-30 15:34:22 +0200 | 
| commit | d39f5aa373a4422f7a5f3ee764fb0f6b0b719d61 (patch) | |
| tree | 1833f8b72a4b3a8f00d0d143b079a8fcad01c6ae /src/cmd/gc/dcl.c | |
| parent | 8652e6c371b8905498d3d314491d36c58d5f68d5 (diff) | |
| download | golang-d39f5aa373a4422f7a5f3ee764fb0f6b0b719d61.tar.gz | |
Imported Upstream version 58upstream/58
Diffstat (limited to 'src/cmd/gc/dcl.c')
| -rw-r--r-- | src/cmd/gc/dcl.c | 42 | 
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; | 
