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

Function traversetable

third-party/lua-5.4.6/src/lgc.c:542–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540
541
542static lu_mem traversetable (global_State *g, Table *h) {
543 const char *weakkey, *weakvalue;
544 const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
545 TString *smode;
546 markobjectN(g, h->metatable);
547 if (mode && ttisshrstring(mode) && /* is there a weak mode? */
548 (cast_void(smode = tsvalue(mode)),
549 cast_void(weakkey = strchr(getshrstr(smode), 'k')),
550 cast_void(weakvalue = strchr(getshrstr(smode), 'v')),
551 (weakkey || weakvalue))) { /* is really weak? */
552 if (!weakkey) /* strong keys? */
553 traverseweakvalue(g, h);
554 else if (!weakvalue) /* strong values? */
555 traverseephemeron(g, h, 0);
556 else /* all weak */
557 linkgclist(h, g->allweak); /* nothing to traverse now */
558 }
559 else /* not weak */
560 traversestrongtable(g, h);
561 return 1 + h->alimit + 2 * allocsizenode(h);
562}
563
564
565static int traverseudata (global_State *g, Udata *u) {

Callers 1

propagatemarkFunction · 0.70

Calls 3

traverseweakvalueFunction · 0.70
traverseephemeronFunction · 0.70
traversestrongtableFunction · 0.70

Tested by

no test coverage detected