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

Merged
merged 1 commit into from
Jan 23, 2025

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.

spec.html Outdated Show resolved Hide resolved
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; we'll pull in the suggested change when landing.

(It's a little silly that we call GetGeneratorKind outside of generators, but we do for return statements. I'd mildly prefer to instead check if we are in a generator, and then do GetGeneratorKind, so that GetGeneratorKind can assert that it is always called from within a generator. But that is a different PR.)

@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Jan 22, 2025
@ljharb ljharb force-pushed the assert-yield-generatorkind branch from a04e9de to ac5cd49 Compare January 23, 2025 05:57
ljharb pushed a commit to d01c2/ecma262 that referenced this pull request Jan 23, 2025
ljharb pushed a commit to d01c2/ecma262 that referenced this pull request Jan 23, 2025
@ljharb ljharb force-pushed the assert-yield-generatorkind branch from ac5cd49 to 6fe229b Compare January 23, 2025 06:01
@bakkot

This comment was marked as resolved.

@ljharb ljharb force-pushed the assert-yield-generatorkind branch from 6fe229b to df1c3cc Compare January 23, 2025 06:08
@ljharb ljharb merged commit df1c3cc into tc39:main Jan 23, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants