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

Function traverseweakvalue

third-party/lua-5.2.4/src/lgc.c:355–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353*/
354
355static void traverseweakvalue (global_State *g, Table *h) {
356 Node *n, *limit = gnodelast(h);
357 /* if there is array part, assume it may have white values (do not
358 traverse it just to check) */
359 int hasclears = (h->sizearray > 0);
360 for (n = gnode(h, 0); n < limit; n++) {
361 checkdeadkey(n);
362 if (ttisnil(gval(n))) /* entry is empty? */
363 removeentry(n); /* remove it */
364 else {
365 lua_assert(!ttisnil(gkey(n)));
366 markvalue(g, gkey(n)); /* mark key */
367 if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */
368 hasclears = 1; /* table will have to be cleared */
369 }
370 }
371 if (hasclears)
372 linktable(h, &g->weak); /* has to be cleared later */
373 else /* no white values */
374 linktable(h, &g->grayagain); /* no need to clean */
375}
376
377
378static int traverseephemeron (global_State *g, Table *h) {

Callers 1

traversetableFunction · 0.70

Calls 2

removeentryFunction · 0.70
isclearedFunction · 0.70

Tested by

no test coverage detected