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

Function fxPushPromiseFunctions

xs/sources/xsPromise.c:641–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641void fxPushPromiseFunctions(txMachine* the, txSlot* promise)
642{
643 txSlot* resolve;
644 txSlot* reject;
645 txSlot* object;
646 txSlot* slot;
647 resolve = fxNewHostFunction(the, fxResolvePromise, 1, XS_NO_ID, mxResolvePromiseProfileID);
648 reject = fxNewHostFunction(the, fxRejectPromise, 1, XS_NO_ID, mxRejectPromiseProfileID);
649 slot = object = fxNewInstance(the);
650 slot = object->next = fxNewSlot(the);
651 slot->kind = XS_BOOLEAN_KIND;
652 slot->value.boolean = 0;
653 slot = slot->next = fxNewSlot(the);
654 slot->kind = XS_REFERENCE_KIND;
655 slot->value.reference = promise;
656 slot = mxFunctionInstanceHome(resolve);
657 slot->value.home.object = object;
658 slot = mxFunctionInstanceHome(reject);
659 slot->value.home.object = object;
660 mxPop();
661}
662
663void fxRejectException(txMachine* the, txSlot* rejectFunction)
664{

Callers 5

fxRunImportFunction · 0.85
fxNewAsyncInstanceFunction · 0.85
fxResolvePromiseFunction · 0.85
fx_PromiseFunction · 0.85

Calls 3

fxNewHostFunctionFunction · 0.85
fxNewInstanceFunction · 0.85
fxNewSlotFunction · 0.85

Tested by

no test coverage detected