| 675 | } |
| 676 | |
| 677 | void fxRejectPromise(txMachine* the) |
| 678 | { |
| 679 | txSlot* slot; |
| 680 | txSlot* promise; |
| 681 | txSlot* argument; |
| 682 | txSlot* result; |
| 683 | slot = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.object->next; |
| 684 | if (slot->value.boolean) |
| 685 | return; |
| 686 | slot->value.boolean = 1; |
| 687 | mxPushSlot(slot->next); |
| 688 | promise = the->stack->value.reference; |
| 689 | slot->next = C_NULL; |
| 690 | if (mxArgc > 0) |
| 691 | mxPushSlot(mxArgv(0)); |
| 692 | else |
| 693 | mxPushUndefined(); |
| 694 | argument = the->stack; |
| 695 | #ifdef mxPromisePrint |
| 696 | fprintf(stderr, "fxRejectPromise %d\n", promise->next->ID); |
| 697 | #endif |
| 698 | result = mxPromiseResult(promise); |
| 699 | result->kind = argument->kind; |
| 700 | result->value = argument->value; |
| 701 | slot = mxPromiseThens(promise)->value.reference->next; |
| 702 | if (slot) { |
| 703 | while (slot) { |
| 704 | mxPushReference(slot->value.reference); |
| 705 | mxPush(mxOnRejectedPromiseFunction); |
| 706 | mxCall(); |
| 707 | mxPushSlot(argument); |
| 708 | fxQueueJob(the, 1, promise); |
| 709 | slot = slot->next; |
| 710 | } |
| 711 | mxPromiseThens(promise)->value.reference->next = C_NULL; |
| 712 | } |
| 713 | else { |
| 714 | fxAddUnhandledRejection(the, promise); |
| 715 | } |
| 716 | slot = mxPromiseStatus(promise); |
| 717 | slot->value.integer = mxRejectedStatus; |
| 718 | } |
| 719 | |
| 720 | void fxResolvePromise(txMachine* the) |
| 721 | { |
nothing calls this directly
no test coverage detected