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

Function fx_Iterator_from

xs/sources/xsGenerator.c:484–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482}
483
484void fx_Iterator_from(txMachine* the)
485{
486 txSlot *iterator, *next, *property;
487 mxTemporary(iterator);
488 mxTemporary(next);
489 fxGetIteratorFlattenable(the, mxArgv(0), iterator, next, 1);
490 mxPush(mxIteratorConstructor);
491 mxDub();
492 mxGetID(mxID(_Symbol_hasInstance));
493 mxCall();
494 mxPushSlot(iterator);
495 mxRunCount(1);
496 if (fxToBoolean(the, the->stack)) {
497 mxResult->kind = iterator->kind;
498 mxResult->value = iterator->value;
499 }
500 else {
501 mxPush(mxIteratorWrapperPrototype);
502 property = fxLastProperty(the, fxNewIteratorInstance(the, iterator, mxID(_Iterator)));
503 property = fxNextSlotProperty(the, property, next, XS_NO_ID, XS_INTERNAL_FLAG);
504 mxPullSlot(mxResult);
505 }
506 mxPop();
507 mxPop();
508 mxPop();
509}
510
511void fx_Iterator_prototype_constructor_get(txMachine* the)
512{

Callers

nothing calls this directly

Calls 5

fxGetIteratorFlattenableFunction · 0.85
fxToBooleanFunction · 0.85
fxLastPropertyFunction · 0.85
fxNewIteratorInstanceFunction · 0.85
fxNextSlotPropertyFunction · 0.85

Tested by

no test coverage detected