MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / collectvalidlines

Function collectvalidlines

xrepo/packages/l/lua/port/lua/src/ldebug.c:290–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

lua_getinfoFunction · 0.85

Calls 3

nextlineFunction · 0.85
luaH_setintFunction · 0.85
luaH_newFunction · 0.70

Tested by

no test coverage detected