MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / traversetable

Function traversetable

extlibs/lua/src/lgc.c:483–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481
482
483static lu_mem traversetable (global_State *g, Table *h) {
484 const char *weakkey, *weakvalue;
485 const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
486 markobjectN(g, h->metatable);
487 if (mode && ttisstring(mode) && /* is there a weak mode? */
488 (cast_void(weakkey = strchr(svalue(mode), 'k')),
489 cast_void(weakvalue = strchr(svalue(mode), 'v')),
490 (weakkey || weakvalue))) { /* is really weak? */
491 black2gray(h); /* keep table gray */
492 if (!weakkey) /* strong keys? */
493 traverseweakvalue(g, h);
494 else if (!weakvalue) /* strong values? */
495 traverseephemeron(g, h, 0);
496 else /* all weak */
497 linkgclist(h, g->allweak); /* nothing to traverse now */
498 }
499 else /* not weak */
500 traversestrongtable(g, h);
501 return 1 + h->alimit + 2 * allocsizenode(h);
502}
503
504
505static int traverseudata (global_State *g, Udata *u) {

Callers 1

propagatemarkFunction · 0.85

Calls 3

traverseweakvalueFunction · 0.85
traverseephemeronFunction · 0.85
traversestrongtableFunction · 0.85

Tested by

no test coverage detected