Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/nitro-core/native/cpp/utils/AssertPromiseState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
namespace margelo::nitro {
template <typename TResult>
class Promise;

// Declared up here, next to the `Promise` forward declaration, because
// Promise.hpp (included below) uses PromiseTask and includes this header back.
// Whichever of the two is entered first must therefore have PromiseTask
// already visible — as happens when a build system compiles the module's
// public headers as a clang module and enters this one first.
enum PromiseTask { WANTS_TO_RESOLVE, WANTS_TO_REJECT };
} // namespace margelo::nitro

#include "NitroTypeInfo.hpp"
Expand All @@ -19,8 +26,6 @@ class Promise;

namespace margelo::nitro {

enum PromiseTask { WANTS_TO_RESOLVE, WANTS_TO_REJECT };

template <typename TResult>
void assertPromiseState(Promise<TResult>& promise, PromiseTask task) {
if (!promise.isPending()) [[unlikely]] {
Expand Down