From 4f88fc8513162fce0f1d39c099a994b91934ce7c Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Fri, 13 Dec 2019 20:53:59 -0500 Subject: Bug 1343481 - Part 5: Rename AsyncFunction-related names in Promise.cpp to explicitly say Async Function. Tag #1287 --- js/src/builtin/Promise.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'js') diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp index 884cd6bac9..021f6021f3 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 reaction, - MutableHandleValue rval) +AsyncFunctionAwaitPromiseReactionJob(JSContext* cx, Handle 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 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 reaction(cx, &reactionObj->as()); - 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 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 resultPromise, Hand if (!reaction) return false; - reaction->setIsAwait(); + reaction->setIsAsyncFunctionAwait(); // Step 8. return PerformPromiseThenWithReaction(cx, promise, reaction); -- cgit v1.2.3