MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxAsyncGeneratorResolveYield

Function fxAsyncGeneratorResolveYield

xs/sources/xsGenerator.c:1634–1668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1632}
1633
1634void fxAsyncGeneratorResolveYield(txMachine* the)
1635{
1636 txSlot* home = mxFunctionInstanceHome(mxFunction->value.reference);
1637 txSlot* generator = home->value.home.object;
1638 txSlot* stack = generator->next;
1639 txSlot* state = stack->next;
1640 txSlot* queue = state->next;
1641 txSlot* current = queue->value.list.first;
1642 if (current) {
1643 txSlot* resolveFunction = current->value.reference->next;
1644
1645 mxPushUndefined();
1646 mxPushSlot(resolveFunction);
1647 mxCall();
1648 mxPushSlot(mxArgv(0));
1649 fxNewGeneratorResult(the, (state->value.integer == XS_CODE_END) ? 1 : 0);
1650
1651 queue->value.list.first = current = current->next;
1652 if (current == C_NULL)
1653 queue->value.list.last = C_NULL;
1654
1655 mxRunCount(1);
1656 mxPop();
1657 }
1658
1659 if (current) {
1660 txSlot* resolveFunction = current->value.reference->next;
1661 txSlot* rejectFunction = resolveFunction->next;
1662 txSlot* status = rejectFunction->next;
1663 txSlot* value = status->next;
1664 the->scratch.kind = value->kind;
1665 the->scratch.value = value->value;
1666 fxAsyncGeneratorStep(the, generator, status->value.integer);
1667 }
1668}
1669
1670void fxAsyncGeneratorStep(txMachine* the, txSlot* generator, txFlag status)
1671{

Callers

nothing calls this directly

Calls 2

fxNewGeneratorResultFunction · 0.85
fxAsyncGeneratorStepFunction · 0.85

Tested by

no test coverage detected