summaryrefslogtreecommitdiff
path: root/js/src/builtin
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-12-13 20:53:59 -0500
committerGaming4JC <g4jc@hyperbola.info>2019-12-17 06:25:24 -0500
commit4f88fc8513162fce0f1d39c099a994b91934ce7c (patch)
tree00ba53ac1c2cef579f41985370a08b2c5f654e67 /js/src/builtin
parent73c8732000a5d594322c8aa33840a3449cf8bd4e (diff)
downloaduxp-4f88fc8513162fce0f1d39c099a994b91934ce7c.tar.gz
Bug 1343481 - Part 5: Rename AsyncFunction-related names in Promise.cpp to explicitly say Async Function.
Tag #1287
Diffstat (limited to 'js/src/builtin')
-rw-r--r--js/src/builtin/Promise.cpp36
1 files changed, 18 insertions, 18 deletions
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<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);