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

Function fxGetIteratorFlattenable

xs/sources/xsGenerator.c:327–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327txBoolean fxGetIteratorFlattenable(txMachine* the, txSlot* iterable, txSlot* iterator, txSlot* next, txBoolean optional)
328{
329 if (!mxIsReference(iterable)) {
330 if (optional) {
331 if ((iterable->kind != XS_STRING_KIND) && (iterable->kind != XS_STRING_X_KIND))
332 mxTypeError("iterator: not a string");
333 }
334 else
335 mxTypeError("iterator: not an object");
336 }
337 mxPushSlot(iterable);
338 mxDub();
339 mxGetID(mxID(_Symbol_iterator));
340 if ((mxIsUndefined(the->stack) || mxIsNull(the->stack)))
341 mxPop();
342 else {
343 mxCall();
344 mxRunCount(0);
345 }
346 if (!mxIsReference(the->stack))
347 mxTypeError("iterator: not an object");
348 mxDub();
349 mxGetID(mxID(_next));
350 mxPullSlot(next);
351 mxPullSlot(iterator);
352 return 1;
353}
354
355txSlot* fxNewIteratorInstance(txMachine* the, txSlot* iterable, txID id)
356{

Callers 2

fx_Iterator_fromFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected