summaryrefslogtreecommitdiff
path: root/external/mit/lua/dist/src/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'external/mit/lua/dist/src/ldo.c')
-rw-r--r--external/mit/lua/dist/src/ldo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/external/mit/lua/dist/src/ldo.c b/external/mit/lua/dist/src/ldo.c
index bd70ea71243..c86c6cb003a 100644
--- a/external/mit/lua/dist/src/ldo.c
+++ b/external/mit/lua/dist/src/ldo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ldo.c,v 1.10 2023/04/16 20:46:17 nikita Exp $ */
+/* $NetBSD: ldo.c,v 1.11 2023/04/17 19:54:19 nikita Exp $ */
/*
** Id: ldo.c
@@ -431,14 +431,15 @@ l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) {
break;
default: /* two/more results and/or to-be-closed variables */
if (hastocloseCfunc(wanted)) { /* to-be-closed variables? */
- ptrdiff_t savedres = savestack(L, res);
L->ci->callstatus |= CIST_CLSRET; /* in case of yields */
L->ci->u2.nres = nres;
- luaF_close(L, res, CLOSEKTOP, 1);
+ res = luaF_close(L, res, CLOSEKTOP, 1);
L->ci->callstatus &= ~CIST_CLSRET;
- if (L->hookmask) /* if needed, call hook after '__close's */
+ if (L->hookmask) { /* if needed, call hook after '__close's */
+ ptrdiff_t savedres = savestack(L, res);
rethook(L, L->ci, nres);
- res = restorestack(L, savedres); /* close and hook can move stack */
+ res = restorestack(L, savedres); /* hook can move stack */
+ }
wanted = decodeNresults(wanted);
if (wanted == LUA_MULTRET)
wanted = nres; /* we want all results */
@@ -655,8 +656,7 @@ static int finishpcallk (lua_State *L, CallInfo *ci) {
else { /* error */
StkId func = restorestack(L, ci->u2.funcidx);
L->allowhook = getoah(ci->callstatus); /* restore 'allowhook' */
- luaF_close(L, func, status, 1); /* can yield or raise an error */
- func = restorestack(L, ci->u2.funcidx); /* stack may be moved */
+ func = luaF_close(L, func, status, 1); /* can yield or raise an error */
luaD_seterrorobj(L, status, func);
luaD_shrinkstack(L); /* restore stack size in case of overflow */
setcistrecst(ci, LUA_OK); /* clear original status */