| 143 | } |
| 144 | |
| 145 | txSlot* fxNewPromiseCapability(txMachine* the, txSlot* resolveFunction, txSlot* rejectFunction) |
| 146 | { |
| 147 | txSlot* capability; |
| 148 | txSlot* slot; |
| 149 | txSlot* function; |
| 150 | mxNew(); |
| 151 | resolveFunction->value.reference = fxNewHostFunction(the, fxNewPromiseCapabilityCallback, 2, XS_NO_ID, mxNewPromiseCapabilityCallbackProfileID); |
| 152 | resolveFunction->kind = XS_REFERENCE_KIND; |
| 153 | mxRunCount(1); |
| 154 | capability = resolveFunction->value.reference; |
| 155 | resolveFunction->kind = XS_UNDEFINED_KIND; |
| 156 | slot = mxFunctionInstanceHome(capability)->value.home.object; |
| 157 | if (!slot) |
| 158 | mxTypeError("executor not called"); |
| 159 | slot = slot->next; |
| 160 | if (!mxIsReference(slot)) |
| 161 | mxTypeError("resolve: not an object"); |
| 162 | function = slot->value.reference; |
| 163 | if (!mxIsFunction(function)) |
| 164 | mxTypeError("resolve: not a function"); |
| 165 | resolveFunction->kind = XS_REFERENCE_KIND; |
| 166 | resolveFunction->value.reference = function; |
| 167 | slot = slot->next; |
| 168 | if (!mxIsReference(slot)) |
| 169 | mxTypeError("reject: not an object"); |
| 170 | function = slot->value.reference; |
| 171 | if (!mxIsFunction(function)) |
| 172 | mxTypeError("reject: not a function"); |
| 173 | rejectFunction->kind = XS_REFERENCE_KIND; |
| 174 | rejectFunction->value.reference = function; |
| 175 | return the->stack->value.reference; |
| 176 | } |
| 177 | |
| 178 | void fxNewPromiseCapabilityCallback(txMachine* the) |
| 179 | { |
no test coverage detected