Fix incorrect line counting when running REPT blocks.

Fixes #461
This commit is contained in:
ISSOtm
2019-12-12 23:46:10 +01:00
parent 373762dedc
commit 8a1e920e23
3 changed files with 20 additions and 3 deletions

View File

@@ -163,7 +163,8 @@ static int32_t popcontext(void)
}
yy_delete_buffer(CurrentFlexHandle);
nLineNo = pLastFile->nLine;
nLineNo = nCurrentStatus == STAT_isREPTBlock ? nCurrentREPTBodyLastLine
: pLastFile->nLine;
if (nCurrentStatus == STAT_isInclude)
fclose(pCurrentFile);
@@ -190,8 +191,6 @@ static int32_t popcontext(void)
nCurrentREPTBlockSize = pLastFile->nREPTBlockSize;
nCurrentREPTBlockCount = pLastFile->nREPTBlockCount;
nCurrentREPTBodyFirstLine = pLastFile->nREPTBodyFirstLine;
/* + 1 to account for the `ENDR` line */
nLineNo = pLastFile->nREPTBodyLastLine + 1;
break;
default:
fatalerror("%s: Internal error.", __func__);