|
@@ -301,7 +301,14 @@ static void collectvalidlines (lua_State *L, Closure *f) {
|
|
sethvalue2s(L, L->top, t); /* push it on stack */
|
|
sethvalue2s(L, L->top, t); /* push it on stack */
|
|
api_incr_top(L);
|
|
api_incr_top(L);
|
|
setbtvalue(&v); /* boolean 'true' to be the value of all indices */
|
|
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 */
|
|
currentline = nextline(p, currentline, i); /* get its line */
|
|
luaH_setint(L, t, currentline, &v); /* table[line] = true */
|
|
luaH_setint(L, t, currentline, &v); /* table[line] = true */
|
|
}
|
|
}
|