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