Skip to content

Commit

Permalink
export mxRejectedStatus as fxPromiseIsRejected()
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Jan 11, 2020
1 parent 60a508c commit c9423d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xs/sources/xsPromise.c
Original file line number Diff line number Diff line change
Expand Up @@ -1439,4 +1439,16 @@ txS1 fxPromiseIsPending(txMachine* the, txSlot* instance) {
return status->value.integer == mxPendingStatus;
}

txS1 fxPromiseIsRejected(txMachine* the, txSlot* instance) {
if (instance->kind != XS_REFERENCE_KIND) {
return 0;
}
txSlot *promise = instance->value.reference;
if (!mxIsPromise(promise)) {
return 0;
}
txSlot* status = mxPromiseStatus(promise);
return status->value.integer == mxRejectedStatus;
}


0 comments on commit c9423d1

Please sign in to comment.