** Completes the execution of an interrupted C function, calling its ** continuation function. */
| 516 | ** continuation function. |
| 517 | */ |
| 518 | static void finishCcall (lua_State *L, int status) { |
| 519 | CallInfo *ci = L->ci; |
| 520 | int n; |
| 521 | /* must have a continuation and must be able to call it */ |
| 522 | lua_assert(ci->u.c.k != NULL && L->nny == 0); |
| 523 | /* error status can only happen in a protected call */ |
| 524 | lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD); |
| 525 | if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */ |
| 526 | ci->callstatus &= ~CIST_YPCALL; /* continuation is also inside it */ |
| 527 | L->errfunc = ci->u.c.old_errfunc; /* with the same error function */ |
| 528 | } |
| 529 | /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already |
| 530 | handled */ |
| 531 | adjustresults(L, ci->nresults); |
| 532 | lua_unlock(L); |
| 533 | n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation function */ |
| 534 | lua_lock(L); |
| 535 | api_checknelems(L, n); |
| 536 | luaD_poscall(L, ci, L->top - n, n); /* finish 'luaD_precall' */ |
| 537 | } |
| 538 | |
| 539 | |
| 540 | /* |
no test coverage detected