-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: Replace IteratorStep with NextMethod #44
Conversation
Fixes #33. Prevents an infinite loop caused by IteratorStep(iteratorRecord) not actually flagging termination when IteratorRecord is async. Instead, we will directly call iteratorStep.[[NextMethod]], like how `for await` does. Co-Authored-By: Kevin Gibbons <bakkot@gmail.com>
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.
For my part, this LGTM
1. Set _nextResult_ to ? Await(_nextResult_). | ||
1. If _nextResult_ is not an Object, throw a *TypeError* exception. | ||
1. Let _done_ be ? IteratorComplete(_nextResult_). | ||
1. If _done_ is *true*, | ||
1. Perform ? Set(_A_, *"length"*, 𝔽(_k_), *true*). | ||
1. Return Completion Record { [[Type]]: ~return~, [[Value]]: _A_, [[Target]]: ~empty~ }. | ||
1. Let _nextValue_ be ? IteratorValue(_next_). |
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.
Hey! Sorry for the post-merge review comment, but should this now be IteratorValue(_nextResult_)
?
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.
You’re right. Thank you for spotting this. I opened #45 and plan to merge it in a few days if nobody else spots any more problems.
Finish #44’s change, which fixes #33. Co-Authored-By: Kevin Gibbons <bakkot@gmail.com> #44 renamed _next_ to _nextResult_ but one reference was left unchanged. Spotted by @trflynn89.
Finish #44’s change, which fixes #33. Co-Authored-By: Kevin Gibbons <bakkot@gmail.com> #44 renamed _next_ to _nextResult_ but one reference was left unchanged. Spotted by @trflynn89.
Finish #44’s change, which fixes #33. Co-Authored-By: Kevin Gibbons <bakkot@gmail.com> #44 renamed _next_ to _nextResult_ but one reference was left unchanged. Spotted by @trflynn89.
Fixes #33.
Prevents an infinite loop caused by IteratorStep(iteratorRecord) not actually flagging termination when IteratorRecord is async. Instead, we will directly call iteratorStep.[[NextMethod]], like how
for await
does. Uses the patch suggested by @bakkot.