| 353 | */ |
| 354 | |
| 355 | static 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 | |
| 378 | static int traverseephemeron (global_State *g, Table *h) { |
no test coverage detected