1
0
mirror of https://github.com/golang/go synced 2024-11-25 02:07:58 -07:00

gc: more accurate line numbers for ATEXT

and other begin and end of function code

R=ken2
CC=golang-dev
https://golang.org/cl/2158044
This commit is contained in:
Russ Cox 2010-09-09 17:11:51 -04:00
parent 4427965ee4
commit 1678dcc378
4 changed files with 13 additions and 0 deletions

View File

@ -62,6 +62,8 @@ compile(Node *fn)
pl = newplist();
pl->name = curfn->nname;
setlineno(curfn);
nodconst(&nod1, types[TINT32], 0);
ptxt = gins(ATEXT, curfn->nname, &nod1);
afunclit(&ptxt->from);
@ -93,6 +95,8 @@ compile(Node *fn)
genlist(curfn->exit);
if(nerrors != 0)
goto ret;
if(curfn->endlineno)
lineno = curfn->endlineno;
pc->as = ARET; // overwrite AEND
pc->lineno = lineno;

View File

@ -62,6 +62,8 @@ compile(Node *fn)
pl = newplist();
pl->name = curfn->nname;
setlineno(curfn);
nodconst(&nod1, types[TINT32], 0);
ptxt = gins(ATEXT, curfn->nname, &nod1);
afunclit(&ptxt->from);
@ -83,6 +85,8 @@ compile(Node *fn)
checklabels();
if(nerrors != 0)
goto ret;
if(curfn->endlineno)
lineno = curfn->endlineno;
if(curfn->type->outtuple != 0)
ginscall(throwreturn, 0);

View File

@ -64,6 +64,8 @@ compile(Node *fn)
pl = newplist();
pl->name = curfn->nname;
setlineno(curfn);
nodconst(&nod1, types[TINT32], 0);
ptxt = gins(ATEXT, curfn->nname, &nod1);
afunclit(&ptxt->from);
@ -85,6 +87,8 @@ compile(Node *fn)
checklabels();
if(nerrors != 0)
goto ret;
if(curfn->endlineno)
lineno = curfn->endlineno;
if(curfn->type->outtuple != 0)
ginscall(throwreturn, 0);

View File

@ -1100,6 +1100,7 @@ xfndcl:
if($$ == N)
break;
$$->nbody = $3;
$$->endlineno = lineno;
funcbody($$);
}