| 5922 | |
| 5923 | |
| 5924 | void luaF_close (lua_State *L, StkId level) { |
| 5925 | UpVal *uv; |
| 5926 | global_State *g = G(L); |
| 5927 | while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { |
| 5928 | GCObject *o = obj2gco(uv); |
| 5929 | lua_assert(!isblack(o) && uv->v != &uv->u.value); |
| 5930 | L->openupval = uv->next; /* remove from `open' list */ |
| 5931 | if (isdead(g, o)) |
| 5932 | luaF_freeupval(L, uv); /* free upvalue */ |
| 5933 | else { |
| 5934 | unlinkupval(uv); |
| 5935 | setobj(L, &uv->u.value, uv->v); |
| 5936 | uv->v = &uv->u.value; /* now current value lives here */ |
| 5937 | luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ |
| 5938 | } |
| 5939 | } |
| 5940 | } |
| 5941 | |
| 5942 | |
| 5943 | Proto *luaF_newproto (lua_State *L) { |
no test coverage detected