MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / resume

Function resume

deps/lua/src/ldo.c:384–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382
383
384static 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
409static int resume_error (lua_State *L, const char *msg) {

Callers

nothing calls this directly

Calls 3

luaD_precallFunction · 0.85
luaD_poscallFunction · 0.85
luaV_executeFunction · 0.85

Tested by

no test coverage detected