summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-01-13 13:54:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-01-13 13:54:10 -0300
commitb07fc10e91a5954254b47280aba287220c734a4b (patch)
treee50d4e5ef9aab68487caf0944e72a7de04bb8bb5 /ldo.c
parentcc1692515e2a6aabc6d07159e7926656e38eda53 (diff)
downloadlua-github-b07fc10e91a5954254b47280aba287220c734a4b.tar.gz
Allow yields inside '__close' metamethods
Initial implementation to allow yields inside '__close' metamethods. This current version still does not allow a '__close' metamethod to yield when called due to an error. '__close' metamethods from C functions also are not allowed to yield.
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index ba0c93b8..aa159cf0 100644
--- a/ldo.c
+++ b/ldo.c
@@ -406,7 +406,7 @@ static void moveresults (lua_State *L, StkId res, int nres, int wanted) {
default: /* multiple results (or to-be-closed variables) */
if (hastocloseCfunc(wanted)) { /* to-be-closed variables? */
ptrdiff_t savedres = savestack(L, res);
- luaF_close(L, res, CLOSEKTOP); /* may change the stack */
+ luaF_close(L, res, CLOSEKTOP, 0); /* may change the stack */
res = restorestack(L, savedres);
wanted = codeNresults(wanted); /* correct value */
if (wanted == LUA_MULTRET)
@@ -647,7 +647,7 @@ static void recover (lua_State *L, void *ud) {
/* "finish" luaD_pcall */
L->ci = ci;
L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */
- luaF_close(L, func, status); /* may change the stack */
+ luaF_close(L, func, status, 0); /* may change the stack */
func = restorestack(L, ci->u2.funcidx);
luaD_seterrorobj(L, status, func);
luaD_shrinkstack(L); /* restore stack size in case of overflow */
@@ -803,7 +803,7 @@ struct CloseP {
*/
static void closepaux (lua_State *L, void *ud) {
struct CloseP *pcl = cast(struct CloseP *, ud);
- luaF_close(L, pcl->level, pcl->status);
+ luaF_close(L, pcl->level, pcl->status, 0);
}