From 39a14ea7d7b14172595c61619e8f35c2614b2606 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 28 Jan 2025 11:45:45 -0300 Subject: CallInfo bit CIST_CLSRET broken in two Since commit f407b3c4a, it was being used for two distinct (and incompatible) meanings: A: Function has TBC variables (now bit CIST_TBC) B: Interpreter is closing TBC variables (original bit CIST_CLSRET) B implies A, but A does not imply B. --- lapi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index c0fd1a1b..7b30617f 100644 --- a/lapi.c +++ b/lapi.c @@ -195,7 +195,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { } newtop = L->top.p + diff; if (diff < 0 && L->tbclist.p >= newtop) { - lua_assert(ci->callstatus & CIST_CLSRET); + lua_assert(ci->callstatus & CIST_TBC); newtop = luaF_close(L, newtop, CLOSEKTOP, 0); } L->top.p = newtop; /* correct top only after closing any upvalue */ @@ -207,7 +207,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) { StkId level; lua_lock(L); level = index2stack(L, idx); - api_check(L, (L->ci->callstatus & CIST_CLSRET) && L->tbclist.p == level, + api_check(L, (L->ci->callstatus & CIST_TBC) && (L->tbclist.p == level), "no variable to close at given level"); level = luaF_close(L, level, CLOSEKTOP, 0); setnilvalue(s2v(level)); @@ -1280,7 +1280,7 @@ LUA_API void lua_toclose (lua_State *L, int idx) { o = index2stack(L, idx); api_check(L, L->tbclist.p < o, "given index below or equal a marked one"); luaF_newtbcupval(L, o); /* create new to-be-closed upvalue */ - L->ci->callstatus |= CIST_CLSRET; /* mark that function has TBC slots */ + L->ci->callstatus |= CIST_TBC; /* mark that function has TBC slots */ lua_unlock(L); } -- cgit v1.2.3-55-g6feb