Skip to content
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

Update for IteratorStep return values #3

Closed
wants to merge 1 commit into from

Conversation

gibson042
Copy link

IteratorStep returns "either an Object or DONE, or a throw completion".

@bakkot
Copy link
Collaborator

bakkot commented Jun 11, 2024

This works but better is to use IteratorStepValue

@gibson042
Copy link
Author

Is that compatible with the Yield in the middle?

@bakkot
Copy link
Collaborator

bakkot commented Jun 11, 2024

There isn't a Yield in the middle, is there? The Yield is after the IteratorValue.

@gibson042
Copy link
Author

IteratorStepValue does

1. Let _result_ be ? IteratorStep(_iteratorRecord_).
1. If _result_ is ~done~, then
  1. Return ~done~.
1. Let _value_ be Completion(IteratorValue(_result_)).

while this operation does

1. Let _innerNext_ be ? IteratorStep(_iteratorRecord_).
1. If _innerNext_ is ~done~, then
  1. Set _innerAlive_ to *false*.
1. Else,
  1. Let _innerValue_ be ? IteratorValue(_innerNext_).
  1. Let _completion_ be Completion(Yield(_innerValue_)).

i.e., IteratorStepValue looks at Completion(IteratorValue($resultFromIteratorStep)) while this operation looks at Completion(Yield(IteratorValue($resultFromIteratorStep))). But it's definitely possible that I'm missing something; I haven't familiarized myself with this part of the spec since introduction of those helper ops.

@michaelficarra
Copy link
Member

Fixed using IteratorStepValue in 5e6e3c3. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants