Commit 1678dcc3 authored by Russ Cox's avatar Russ Cox

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
parent 4427965e
......@@ -61,6 +61,8 @@ compile(Node *fn)
pl = newplist();
pl->name = curfn->nname;
setlineno(curfn);
nodconst(&nod1, types[TINT32], 0);
ptxt = gins(ATEXT, curfn->nname, &nod1);
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -1100,6 +1100,7 @@ xfndcl:
if($$ == N)
break;
$$->nbody = $3;
$$->endlineno = lineno;
funcbody($$);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment