mirror of
https://github.com/golang/go
synced 2024-11-25 10:07:56 -07:00
gc: implement new return restriction
R=ken2 CC=golang-dev https://golang.org/cl/5245056
This commit is contained in:
parent
06862617c1
commit
c18d1a78a4
@ -1546,6 +1546,18 @@ non_dcl_stmt:
|
||||
{
|
||||
$$ = nod(ORETURN, N, N);
|
||||
$$->list = $2;
|
||||
if($$->list == nil) {
|
||||
NodeList *l;
|
||||
|
||||
for(l=curfn->dcl; l; l=l->next) {
|
||||
if(l->n->class == PPARAM)
|
||||
continue;
|
||||
if(l->n->class != PPARAMOUT)
|
||||
break;
|
||||
if(l->n->sym->def != l->n)
|
||||
yyerror("%s is shadowed during return", l->n->sym->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stmt_list:
|
||||
|
Loading…
Reference in New Issue
Block a user