Skip to content

Editorial: fix note in AsyncBlockStart to not assume its argument is a function #3604

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented May 15, 2025

AsyncBlockStart is also used for modules which have top-level awaits.

…a function

AsyncBlockStart is also used for modules which have top-level awaits.
@@ -50564,7 +50564,7 @@ <h1>
1. Else,
1. Assert: _asyncBody_ is an Abstract Closure with no parameters.
1. Let _result_ be _asyncBody_().
1. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done.
1. Assert: If we return here, evaluation has finished either by throwing, by an explicit return, or by reaching the end of the Parse Node; all awaiting is done.
Copy link
Member

Choose a reason for hiding this comment

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

"reaching the end of the Parse Node" is unclear to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggest an alternative wording for "got to the end of the module or function body"?

Copy link
Member

Choose a reason for hiding this comment

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

something like "did not encounter a return, throw, or any expression that threw during Evaluation"?

Also this should be a Note, not an Assert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could have done one of those things and had it swallowed by a catch or finally, so that would be wrong. Also that reads pretty awkwardly with the rest of the sentence.

This seems fine as an Assert to me: it's making explicit an invariant that would otherwise be implicit, which is exactly what Asserts are for.

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.

2 participants