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

Function luaF_closeupval

third-party/lua-5.5.0/src/lfunc.c:197–210  ·  view source on GitHub ↗

** Close all upvalues up to the given stack level. */

Source from the content-addressed store, hash-verified

195** Close all upvalues up to the given stack level.
196*/
197void luaF_closeupval (lua_State *L, StkId level) {
198 UpVal *uv;
199 while ((uv = L->openupval) != NULL && uplevel(uv) >= level) {
200 TValue *slot = &uv->u.value; /* new position for value */
201 lua_assert(uplevel(uv) < L->top.p);
202 luaF_unlinkupval(uv); /* remove upvalue from 'openupval' list */
203 setobj(L, slot, uv->v.p); /* move value to upvalue slot */
204 uv->v.p = slot; /* now current value lives here */
205 if (!iswhite(uv)) { /* neither white nor dead? */
206 nw2black(uv); /* closed upvalues cannot be gray */
207 luaC_barrier(L, uv, slot);
208 }
209 }
210}
211
212
213/*

Callers 3

luaV_executeFunction · 0.70
luaE_freethreadFunction · 0.70
luaF_closeFunction · 0.70

Calls 1

luaF_unlinkupvalFunction · 0.70

Tested by

no test coverage detected