| 382 | |
| 383 | |
| 384 | static void resume (lua_State *L, void *ud) { |
| 385 | StkId firstArg = cast(StkId, ud); |
| 386 | CallInfo *ci = L->ci; |
| 387 | if (L->status == 0) { /* start coroutine? */ |
| 388 | lua_assert(ci == L->base_ci && firstArg > L->base); |
| 389 | if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) |
| 390 | return; |
| 391 | } |
| 392 | else { /* resuming from previous yield */ |
| 393 | lua_assert(L->status == LUA_YIELD); |
| 394 | L->status = 0; |
| 395 | if (!f_isLua(ci)) { /* `common' yield? */ |
| 396 | /* finish interrupted execution of `OP_CALL' */ |
| 397 | lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || |
| 398 | GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); |
| 399 | if (luaD_poscall(L, firstArg)) /* complete it... */ |
| 400 | L->top = L->ci->top; /* and correct top if not multiple results */ |
| 401 | } |
| 402 | else /* yielded inside a hook: just continue its execution */ |
| 403 | L->base = L->ci->base; |
| 404 | } |
| 405 | luaV_execute(L, cast_int(L->ci - L->base_ci)); |
| 406 | } |
| 407 | |
| 408 | |
| 409 | static int resume_error (lua_State *L, const char *msg) { |
nothing calls this directly
no test coverage detected