| 94 | |
| 95 | |
| 96 | void luaF_close (lua_State *L, StkId level) { |
| 97 | UpVal *uv; |
| 98 | global_State *g = G(L); |
| 99 | while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { |
| 100 | GCObject *o = obj2gco(uv); |
| 101 | lua_assert(!isblack(o) && uv->v != &uv->u.value); |
| 102 | L->openupval = uv->next; /* remove from `open' list */ |
| 103 | if (isdead(g, o)) |
| 104 | luaF_freeupval(L, uv); /* free upvalue */ |
| 105 | else { |
| 106 | unlinkupval(uv); |
| 107 | setobj(L, &uv->u.value, uv->v); |
| 108 | uv->v = &uv->u.value; /* now current value lives here */ |
| 109 | luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | |
| 115 | Proto *luaF_newproto (lua_State *L) { |
no test coverage detected