| 288 | |
| 289 | |
| 290 | static void collectvalidlines (lua_State *L, Closure *f) { |
| 291 | if (!LuaClosure(f)) { |
| 292 | setnilvalue(s2v(L->top.p)); |
| 293 | api_incr_top(L); |
| 294 | } |
| 295 | else { |
| 296 | const Proto *p = f->l.p; |
| 297 | int currentline = p->linedefined; |
| 298 | Table *t = luaH_new(L); /* new table to store active lines */ |
| 299 | sethvalue2s(L, L->top.p, t); /* push it on stack */ |
| 300 | api_incr_top(L); |
| 301 | if (p->lineinfo != NULL) { /* proto with debug information? */ |
| 302 | int i; |
| 303 | TValue v; |
| 304 | setbtvalue(&v); /* boolean 'true' to be the value of all indices */ |
| 305 | if (!p->is_vararg) /* regular function? */ |
| 306 | i = 0; /* consider all instructions */ |
| 307 | else { /* vararg function */ |
| 308 | lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP); |
| 309 | currentline = nextline(p, currentline, 0); |
| 310 | i = 1; /* skip first instruction (OP_VARARGPREP) */ |
| 311 | } |
| 312 | for (; i < p->sizelineinfo; i++) { /* for each instruction */ |
| 313 | currentline = nextline(p, currentline, i); /* get its line */ |
| 314 | luaH_setint(L, t, currentline, &v); /* table[line] = true */ |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | |
| 321 | static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { |
no test coverage detected