1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:27:39 +00:00

LibJS: Annotate Promise implementation with spec comments

I wanted to do this for a long time. The guts of Promise are pretty
complex, and it's easier to understand with the spec right next to it.
Also found a couple of issues along the way :^)
This commit is contained in:
Linus Groh 2021-11-14 00:33:16 +00:00
parent df06552b48
commit 01c2570678
7 changed files with 523 additions and 41 deletions

View file

@ -53,11 +53,12 @@ private:
void trigger_reactions() const;
State m_state { State::Pending };
Value m_result;
Vector<PromiseReaction*> m_fulfill_reactions;
Vector<PromiseReaction*> m_reject_reactions;
bool m_is_handled { false };
// 27.2.6 Properties of Promise Instances, https://tc39.es/ecma262/#sec-properties-of-promise-instances
State m_state { State::Pending }; // [[PromiseState]]
Value m_result; // [[PromiseResult]]
Vector<PromiseReaction*> m_fulfill_reactions; // [[PromiseFulfillReactions]]
Vector<PromiseReaction*> m_reject_reactions; // [[PromiseRejectReactions]]
bool m_is_handled { false }; // [[PromiseIsHandled]]
};
}