diff options
-rw-r--r-- | js/src/builtin/Promise.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp index 884cd6bac..021f6021f 100644 --- a/js/src/builtin/Promise.cpp +++ b/js/src/builtin/Promise.cpp @@ -34,8 +34,8 @@ MillisecondsSinceStartup() enum PromiseHandler { PromiseHandlerIdentity = 0, PromiseHandlerThrower, - PromiseHandlerAwaitFulfilled, - PromiseHandlerAwaitRejected, + PromiseHandlerAsyncFunctionAwaitFulfilled, + PromiseHandlerAsyncFunctionAwaitRejected, }; enum ResolutionMode { @@ -184,7 +184,7 @@ enum ReactionRecordSlots { #define REACTION_FLAG_RESOLVED 0x1 #define REACTION_FLAG_FULFILLED 0x2 #define REACTION_FLAG_IGNORE_DEFAULT_RESOLUTION 0x4 -#define REACTION_FLAG_AWAIT 0x8 +#define REACTION_FLAG_ASYNC_FUNCTION_AWAIT 0x8 // ES2016, 25.4.1.2. class PromiseReactionRecord : public NativeObject @@ -211,14 +211,14 @@ class PromiseReactionRecord : public NativeObject flags |= REACTION_FLAG_FULFILLED; setFixedSlot(ReactionRecordSlot_Flags, Int32Value(flags)); } - void setIsAwait() { + void setIsAsyncFunctionAwait() { int32_t flags = this->flags(); - flags |= REACTION_FLAG_AWAIT; + flags |= REACTION_FLAG_ASYNC_FUNCTION_AWAIT; setFixedSlot(ReactionRecordSlot_Flags, Int32Value(flags)); } - bool isAwait() { + bool isAsyncFunctionAwait() { int32_t flags = this->flags(); - return flags & REACTION_FLAG_AWAIT; + return flags & REACTION_FLAG_ASYNC_FUNCTION_AWAIT; } Value handler() { MOZ_ASSERT(targetState() != JS::PromiseState::Pending); @@ -820,10 +820,10 @@ TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal, JS::PromiseStat } static MOZ_MUST_USE bool -AwaitPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction, - MutableHandleValue rval) +AsyncFunctionAwaitPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction, + MutableHandleValue rval) { - MOZ_ASSERT(reaction->isAwait()); + MOZ_ASSERT(reaction->isAsyncFunctionAwait()); RootedValue handlerVal(cx, reaction->handler()); RootedValue argument(cx, reaction->handlerArg()); @@ -831,12 +831,12 @@ AwaitPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction, RootedValue generatorVal(cx, resultPromise->getFixedSlot(PromiseSlot_AwaitGenerator)); int32_t handlerNum = int32_t(handlerVal.toNumber()); - MOZ_ASSERT(handlerNum == PromiseHandlerAwaitFulfilled - || handlerNum == PromiseHandlerAwaitRejected); + MOZ_ASSERT(handlerNum == PromiseHandlerAsyncFunctionAwaitFulfilled || + handlerNum == PromiseHandlerAsyncFunctionAwaitRejected); // Await's handlers don't return a value, nor throw exception. // They fail only on OOM. - if (handlerNum == PromiseHandlerAwaitFulfilled) { + if (handlerNum == PromiseHandlerAsyncFunctionAwaitFulfilled) { if (!AsyncFunctionAwaitedFulfilled(cx, resultPromise, generatorVal, argument)) return false; } else { @@ -891,8 +891,8 @@ PromiseReactionJob(JSContext* cx, unsigned argc, Value* vp) // Steps 1-2. Rooted<PromiseReactionRecord*> reaction(cx, &reactionObj->as<PromiseReactionRecord>()); - if (reaction->isAwait()) - return AwaitPromiseReactionJob(cx, reaction, args.rval()); + if (reaction->isAsyncFunctionAwait()) + return AsyncFunctionAwaitPromiseReactionJob(cx, reaction, args.rval()); // Step 3. RootedValue handlerVal(cx, reaction->handler()); @@ -2202,8 +2202,8 @@ js::AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, Hand return false; // Steps 4-5. - RootedValue onFulfilled(cx, Int32Value(PromiseHandlerAwaitFulfilled)); - RootedValue onRejected(cx, Int32Value(PromiseHandlerAwaitRejected)); + RootedValue onFulfilled(cx, Int32Value(PromiseHandlerAsyncFunctionAwaitFulfilled)); + RootedValue onRejected(cx, Int32Value(PromiseHandlerAsyncFunctionAwaitRejected)); RootedObject incumbentGlobal(cx); if (!GetObjectFromIncumbentGlobal(cx, &incumbentGlobal)) @@ -2217,7 +2217,7 @@ js::AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, Hand if (!reaction) return false; - reaction->setIsAwait(); + reaction->setIsAsyncFunctionAwait(); // Step 8. return PerformPromiseThenWithReaction(cx, promise, reaction); |