-
Couldn't load subscription status.
- Fork 66
Implement Promise All Settled #872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6271720 to
16237ab
Compare
a68dc67 to
fae782c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this looks great! Only one real blocking nit to pick, and then a couple of suggestions on reducing some repetition in the resolving code.
Absolutely stellar stuff! <3
...trol_abstraction_objects/promise_objects/promise_abstract_operations/promise_group_record.rs
Show resolved
Hide resolved
|
|
||
| let data = promise_all.get_mut(agent); | ||
|
|
||
| // i. Set remainingElementsCount.[[Value]] to remainingElementsCount.[[Value]] - 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I think we can probably factor out this part and make it a method of the PromiseGroupRecord: take &mut self, reduce remaining_elements_count by 1, and return (Array, Option<Promise>) with the Promise only getting returned if remaining_elements_count == 0. Now the caller can do an assignment into the Array with their value and then resolve the Promise if they received one.
Also note: this way the code doesn't need to first read the result array from the PromiseGroupRecord, then write into that array, and then go back to reading from the PromiseGroupRecord to check the remaining elements count and promise. It can do all of those reads at the same time.
...trol_abstraction_objects/promise_objects/promise_abstract_operations/promise_group_record.rs
Outdated
Show resolved
Hide resolved
...m/src/ecmascript/builtins/control_abstraction_objects/promise_objects/promise_constructor.rs
Outdated
Show resolved
Hide resolved
...tins/control_abstraction_objects/promise_objects/promise_abstract_operations/promise_jobs.rs
Outdated
Show resolved
Hide resolved
…ll and PromiseAllSettled
…ection for PromiseAll and PromiseAllSettled, streamlining promise reaction processing.
… fulfillment and rejection handling, improving code clarity and reducing duplication.
bbf3be7 to
295b9eb
Compare
No description provided.