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

Editorial: Add assertion that generatorKind is not non-generator #3379

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

Conversation

d01c2
Copy link
Contributor

@d01c2 d01c2 commented Jul 25, 2024

According to runtime semantics of _YieldExpression_ : yield * _AssignmentExpression_ evaluation, _generatorKind_ is NON-GENERATOR, SYNC, or ASYNC. However, the type of second parameter of GetIterator is SYNC or ASYNC in current specification. This is type-mismatch. I think GetGeneratorKind cannot return NON-GENERATOR in this case, so this PR includes adding assertion that generatorKind is not NON-GENERATOR.

@@ -24084,6 +24084,7 @@ <h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>YieldExpression : `yield` `*` AssignmentExpression</emu-grammar>
<emu-alg>
1. Let _generatorKind_ be GetGeneratorKind().
1. Assert: _generatorKind_ is not ~non-generator~.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is correct. However, rather than the double negative of "not non-generator", it might be clearer to make the positive assertion:

Suggested change
1. Assert: _generatorKind_ is not ~non-generator~.
1. Assert: _generatorKind_ is either ~sync~ or ~async~.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you. Thanks for making this clearer.

@ljharb ljharb requested a review from a team July 30, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants