MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / traversetable

Function traversetable

3rd/lua-5.4.3/src/lgc.c:536–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534
535
536static lu_mem traversetable (global_State *g, Table *h) {
537 const char *weakkey, *weakvalue;
538 const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
539 markobjectN(g, h->metatable);
540 if (mode && ttisstring(mode) && /* is there a weak mode? */
541 (cast_void(weakkey = strchr(svalue(mode), 'k')),
542 cast_void(weakvalue = strchr(svalue(mode), 'v')),
543 (weakkey || weakvalue))) { /* is really weak? */
544 if (!weakkey) /* strong keys? */
545 traverseweakvalue(g, h);
546 else if (!weakvalue) /* strong values? */
547 traverseephemeron(g, h, 0);
548 else /* all weak */
549 linkgclist(h, g->allweak); /* nothing to traverse now */
550 }
551 else /* not weak */
552 traversestrongtable(g, h);
553 return 1 + h->alimit + 2 * allocsizenode(h);
554}
555
556
557static 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