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

Function fx_Iterator_concat_step

xs/sources/xsGenerator.c:447–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447txBoolean fx_Iterator_concat_step(txMachine* the, txSlot* iterator, txSlot* next, txSlot* extra, txSlot* value, txFlag status)
448{
449 if (status == XS_NO_STATUS) {
450 for (;;) {
451 if (mxIsNull(iterator)) {
452 txSlot* iterable = extra->value.reference->next;
453 if (!iterable)
454 break;
455 mxPushSlot(iterable);
456 mxPushSlot(iterable->next);
457 extra->value.reference->next = iterable->next->next;
458 mxCall();
459 mxRunCount(0);
460 if (!mxIsReference(the->stack))
461 mxTypeError("iterator: not an object");
462 mxDub();
463 mxGetID(mxID(_next));
464 mxPullSlot(next);
465 mxPullSlot(iterator);
466 }
467 if (fxIteratorNext(the, iterator, next, value))
468 return 1;
469 next->kind = XS_NULL_KIND;
470 iterator->kind = XS_NULL_KIND;
471 }
472 }
473 else if (status == XS_RETURN_STATUS) {
474 if (!mxIsNull(iterator))
475 fxIteratorReturn(the, iterator, 0);
476 }
477 else if (status == XS_THROW_STATUS) {
478 if (!mxIsNull(iterator))
479 fxIteratorReturn(the, iterator, 1);
480 }
481 return 0;
482}
483
484void fx_Iterator_from(txMachine* the)
485{

Callers

nothing calls this directly

Calls 2

fxIteratorNextFunction · 0.85
fxIteratorReturnFunction · 0.85

Tested by

no test coverage detected