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

Function fxAddUnhandledRejection

xs/sources/xsPromise.c:207–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void fxAddUnhandledRejection(txMachine* the, txSlot* promise)
208{
209 txSlot* reason = mxPromiseResult(promise);
210 txSlot* list = &mxUnhandledPromises;
211 txSlot** address = &list->value.reference->next;
212 txSlot* slot;
213 while ((slot = *address)) {
214 if (slot->value.weakRef.target == promise)
215 break;
216 mxMeterSome(1);
217 slot = slot->next;
218 address = &slot->next;
219 }
220 if (!slot) {
221#ifdef mxPromisePrint
222 fprintf(stderr, "fxAddUnhandledRejection %d\n", promise->next->ID);
223#endif
224 slot = *address = fxNewSlot(the);
225 slot->kind = XS_WEAK_REF_KIND;
226 slot->value.weakRef.target = promise;
227 slot = slot->next = fxNewSlot(the);
228 slot->kind = reason->kind;
229 slot->value = reason->value;
230 }
231}
232
233void fxCheckUnhandledRejections(txMachine* the, txBoolean atExit)
234{

Callers 2

fxRejectPromiseFunction · 0.85
fxResolvePromiseFunction · 0.85

Calls 1

fxNewSlotFunction · 0.85

Tested by

no test coverage detected