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

Function fxAsyncGeneratorRejectYield

xs/sources/xsGenerator.c:1584–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1582}
1583
1584void fxAsyncGeneratorRejectYield(txMachine* the)
1585{
1586 txSlot* home = mxFunctionInstanceHome(mxFunction->value.reference);
1587 txSlot* generator = home->value.home.object;
1588 txSlot* stack = generator->next;
1589 txSlot* state = stack->next;
1590 if (state->value.integer == XS_CODE_END) {
1591 txSlot* queue = state->next;
1592 txSlot* current = queue->value.list.first;
1593 txSlot* resolveFunction = current->value.reference->next;
1594 txSlot* rejectFunction = resolveFunction->next;
1595
1596 mxPushUndefined();
1597 mxPushSlot(rejectFunction);
1598 mxCall();
1599 mxPushSlot(mxArgv(0));
1600
1601 queue->value.list.first = current = current->next;
1602 if (current == C_NULL)
1603 queue->value.list.last = C_NULL;
1604
1605 mxRunCount(1);
1606 mxPop();
1607
1608 if (current) {
1609 txSlot* resolveFunction = current->value.reference->next;
1610 txSlot* rejectFunction = resolveFunction->next;
1611 txSlot* status = rejectFunction->next;
1612 txSlot* value = status->next;
1613 the->scratch.kind = value->kind;
1614 the->scratch.value = value->value;
1615 fxAsyncGeneratorStep(the, generator, status->value.integer);
1616 }
1617 }
1618 else {
1619 mxPushSlot(mxArgv(0));
1620 mxPull(the->scratch);
1621 fxAsyncGeneratorStep(the, generator, XS_THROW_STATUS);
1622 }
1623}
1624
1625void fxAsyncGeneratorResolveAwait(txMachine* the)
1626{

Callers

nothing calls this directly

Calls 1

fxAsyncGeneratorStepFunction · 0.85

Tested by

no test coverage detected