MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / collectvalidlines

Function collectvalidlines

third-party/lua-5.4.6/src/ldebug.c:293–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291
292
293static 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
324static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {

Callers 1

lua_getinfoFunction · 0.70

Calls 3

luaH_newFunction · 0.70
nextlineFunction · 0.70
luaH_setintFunction · 0.70

Tested by

no test coverage detected