diff --git a/src/cmd/5g/ggen.c b/src/cmd/5g/ggen.c index 328d3284da2..c906064584e 100644 --- a/src/cmd/5g/ggen.c +++ b/src/cmd/5g/ggen.c @@ -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; diff --git a/src/cmd/6g/ggen.c b/src/cmd/6g/ggen.c index f0aa16cb429..6d005d7ece3 100644 --- a/src/cmd/6g/ggen.c +++ b/src/cmd/6g/ggen.c @@ -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); diff --git a/src/cmd/8g/ggen.c b/src/cmd/8g/ggen.c index 5c51833ea20..0c3a8260c2b 100644 --- a/src/cmd/8g/ggen.c +++ b/src/cmd/8g/ggen.c @@ -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); diff --git a/src/cmd/gc/go.y b/src/cmd/gc/go.y index 48b8c711e1e..e210fbd2cd3 100644 --- a/src/cmd/gc/go.y +++ b/src/cmd/gc/go.y @@ -1100,6 +1100,7 @@ xfndcl: if($$ == N) break; $$->nbody = $3; + $$->endlineno = lineno; funcbody($$); }