| 205 | } |
| 206 | |
| 207 | void 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 | |
| 233 | void fxCheckUnhandledRejections(txMachine* the, txBoolean atExit) |
| 234 | { |
no test coverage detected