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

Wrap bare return values with Completion Records in abstract closure #32

Merged
merged 1 commit into from
Aug 20, 2022

Conversation

js-choi
Copy link
Collaborator

@js-choi js-choi commented Aug 17, 2022

Resolves #31, at least temporarily.
(Also affects #14.)

Eventually we might want to make a change to match whatever approach proposal-iterator-helpers does; see tc39/proposal-iterator-helpers#218. But that should be able to be a mere editorial change.

@js-choi js-choi added the bug Something isn't working label Aug 17, 2022
Copy link
Contributor

@bakkot bakkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for now though we will eventually want to change this.

@ljharb
Copy link
Member

ljharb commented Aug 17, 2022

I'm confused why this is necessary - what else would a "return" statement do in an abstract closure?

@bakkot
Copy link
Contributor

bakkot commented Aug 17, 2022

It returns a value to the caller. The caller, in this case, is step 3.b.ii of AsyncBlockStart. You can look at the following steps to see that a.) the caller expects the result to be a Completion Record, not a bare value and b.) if the caller got a normal completion, it would not do the right thing.

"Return" in an abstract closure is mostly unrelated to returning from an ES function, which is handled by a different mechanism.

@js-choi js-choi merged commit d2de0c6 into main Aug 20, 2022
@js-choi js-choi deleted the explicit-completion-records branch August 20, 2022 17:00
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wiring of return value is underspecified
3 participants