| 969 | } |
| 970 | |
| 971 | void fxAsyncDisposableStackResolve(txMachine* the) |
| 972 | { |
| 973 | txSlot* slot = mxFunctionInstanceHome(mxFunction->value.reference); |
| 974 | txSlot* instance = slot->value.home.object; |
| 975 | txSlot* property = instance->next; |
| 976 | txSlot* exception = property->next; |
| 977 | txSlot* resolveStepFunction = exception->next; |
| 978 | txSlot* rejectStepFunction = resolveStepFunction->next; |
| 979 | txSlot* resolveFunction = rejectStepFunction->next; |
| 980 | txSlot* rejectFunction = resolveFunction->next; |
| 981 | |
| 982 | slot = property->value.disposableStack.stack; |
| 983 | if (slot) { |
| 984 | txSlot* dispose = slot; |
| 985 | txSlot* resource = slot->next; |
| 986 | property->value.disposableStack.stack = resource->next; |
| 987 | mxTry(the) { |
| 988 | mxPushUndefined(); |
| 989 | mxPush(mxPromiseConstructor); |
| 990 | if (!mxIsUndefined(dispose)) { |
| 991 | if (dispose->flag & XS_BASE_FLAG) { |
| 992 | mxPushUndefined(); |
| 993 | mxPushSlot(dispose); |
| 994 | mxCall(); |
| 995 | mxPushSlot(resource); |
| 996 | mxRunCount(1); |
| 997 | } |
| 998 | else { |
| 999 | mxPushSlot(resource); |
| 1000 | mxPushSlot(dispose); |
| 1001 | mxCall(); |
| 1002 | mxRunCount(0); |
| 1003 | } |
| 1004 | } |
| 1005 | else |
| 1006 | mxPushUndefined(); |
| 1007 | fx_Promise_resolveAux(the); |
| 1008 | mxPop(); |
| 1009 | mxPop(); |
| 1010 | fxPromiseThen(the, the->stack->value.reference, resolveStepFunction, rejectStepFunction, C_NULL, C_NULL); |
| 1011 | mxPop(); |
| 1012 | } |
| 1013 | mxCatch(the) { |
| 1014 | mxPushUndefined(); |
| 1015 | mxPushSlot(rejectStepFunction); |
| 1016 | mxCall(); |
| 1017 | mxPush(mxException); |
| 1018 | mxException = mxUndefined; |
| 1019 | mxRunCount(1); |
| 1020 | mxPop(); |
| 1021 | } |
| 1022 | } |
| 1023 | else { |
| 1024 | if (mxIsUndefined(exception)) { |
| 1025 | mxPushUndefined(); |
| 1026 | mxPushSlot(resolveFunction); |
| 1027 | mxCall(); |
| 1028 | mxPushUndefined(); |
no test coverage detected