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

Function fx_AggregateError

xs/sources/xsError.c:339–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339void fx_AggregateError(txMachine* the)
340{
341 txSlot* stack = the->stack;
342 txSlot* property = fx_Error_aux(the, XS_AGGREGATE_ERROR, 1);
343 txSlot* array;
344 txSlot** address;
345 txIndex length = 0;
346 txSlot* iterator;
347 txSlot* next;
348 txSlot* value;
349 txSlot* slot;
350
351 mxPush(mxArrayPrototype);
352 array = fxNewArrayInstance(the);
353 fxNextSlotProperty(the, property, the->stack, mxID(_errors), XS_DONT_ENUM_FLAG);
354 address = &array->next->next;
355 mxTemporary(iterator);
356 mxTemporary(next);
357 fxGetIterator(the, mxArgv(0), iterator, next, 0);
358 mxTemporary(value);
359 while (fxIteratorNext(the, iterator, next, value)) {
360 mxTry(the) {
361 *address = slot = fxNewSlot(the);
362 slot->kind = value->kind;
363 slot->value = value->value;
364 address = &slot->next;
365 length++;
366 }
367 mxCatch(the) {
368 fxIteratorReturn(the, iterator, 1);
369 fxJump(the);
370 }
371 }
372 array->next->value.array.length = length;
373 fxCacheArray(the, array);
374
375 the->stack = stack;
376}
377
378void fx_EvalError(txMachine* the)
379{

Callers

nothing calls this directly

Calls 9

fx_Error_auxFunction · 0.85
fxNewArrayInstanceFunction · 0.85
fxNextSlotPropertyFunction · 0.85
fxGetIteratorFunction · 0.85
fxIteratorNextFunction · 0.85
fxNewSlotFunction · 0.85
fxIteratorReturnFunction · 0.85
fxJumpFunction · 0.85
fxCacheArrayFunction · 0.85

Tested by

no test coverage detected