| 231 | } |
| 232 | |
| 233 | void fxCheckUnhandledRejections(txMachine* the, txBoolean atExit) |
| 234 | { |
| 235 | txSlot* list = &mxUnhandledPromises; |
| 236 | txSlot** address = &list->value.reference->next; |
| 237 | txSlot* slot; |
| 238 | if (atExit) { |
| 239 | txIndex count = 0; |
| 240 | while ((slot = *address)) { |
| 241 | #if mxReportUnhandledRejections |
| 242 | if (slot->value.weakRef.target == C_NULL) { |
| 243 | fprintf(stderr, "# garbage collected promise\n"); |
| 244 | } |
| 245 | else { |
| 246 | txSlot* property = mxPromiseEnvironment(slot->value.weakRef.target); |
| 247 | if (property && property->ID) { |
| 248 | fprintf(stderr, "%s:%d\n", fxGetKeyName(the, property->ID), property->value.environment.line); |
| 249 | } |
| 250 | } |
| 251 | #endif |
| 252 | slot = slot->next; |
| 253 | *address = slot->next; |
| 254 | mxException.value = slot->value; |
| 255 | mxException.kind = slot->kind; |
| 256 | count++; |
| 257 | } |
| 258 | if (count > 0) |
| 259 | fxAbort(the, XS_UNHANDLED_REJECTION_EXIT); |
| 260 | } |
| 261 | else { |
| 262 | while ((slot = *address)) { |
| 263 | if (slot->value.weakRef.target == C_NULL) { |
| 264 | slot = slot->next; |
| 265 | *address = slot->next; |
| 266 | mxException.value = slot->value; |
| 267 | mxException.kind = slot->kind; |
| 268 | fxAbort(the, XS_UNHANDLED_REJECTION_EXIT); |
| 269 | } |
| 270 | else { |
| 271 | slot = slot->next; |
| 272 | address = &slot->next; |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | void fxCombinePromises(txMachine* the, txInteger which) |
| 279 | { |
no test coverage detected