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

Function traversetable

third-party/lua-5.3.5/src/lgc.c:451–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449
450
451static lu_mem traversetable (global_State *g, Table *h) {
452 const char *weakkey, *weakvalue;
453 const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
454 markobjectN(g, h->metatable);
455 if (mode && ttisstring(mode) && /* is there a weak mode? */
456 ((weakkey = strchr(svalue(mode), 'k')),
457 (weakvalue = strchr(svalue(mode), 'v')),
458 (weakkey || weakvalue))) { /* is really weak? */
459 black2gray(h); /* keep table gray */
460 if (!weakkey) /* strong keys? */
461 traverseweakvalue(g, h);
462 else if (!weakvalue) /* strong values? */
463 traverseephemeron(g, h);
464 else /* all weak */
465 linkgclist(h, g->allweak); /* nothing to traverse now */
466 }
467 else /* not weak */
468 traversestrongtable(g, h);
469 return sizeof(Table) + sizeof(TValue) * h->sizearray +
470 sizeof(Node) * cast(size_t, allocsizenode(h));
471}
472
473
474/*

Callers 1

propagatemarkFunction · 0.70

Calls 3

traverseweakvalueFunction · 0.70
traverseephemeronFunction · 0.70
traversestrongtableFunction · 0.70

Tested by

no test coverage detected