Avoid OP_VARARGPREP for active lines

when building the table 'activelines' for a vararg function, this
first instruction does not make the first line active.
This commit is contained in:
Roberto Ierusalimschy
2021-11-10 15:07:14 -03:00
parent bfbff3703e
commit e8deac5a41
2 changed files with 51 additions and 1 deletions

View File

@@ -301,7 +301,14 @@ static void collectvalidlines (lua_State *L, Closure *f) {
sethvalue2s(L, L->top, t); /* push it on stack */
api_incr_top(L);
setbtvalue(&v); /* boolean 'true' to be the value of all indices */
for (i = 0; i < p->sizelineinfo; i++) { /* for all instructions */
if (!p->is_vararg) /* regular function? */
i = 0; /* consider all instructions */
else { /* vararg function */
lua_assert(p->code[0] == OP_VARARGPREP);
currentline = nextline(p, currentline, 0);
i = 1; /* skip first instruction (OP_VARARGPREP) */
}
for (; i < p->sizelineinfo; i++) { /* for each instruction */
currentline = nextline(p, currentline, i); /* get its line */
luaH_setint(L, t, currentline, &v); /* table[line] = true */
}