Skip to content

disallow 'await' and 'yield' in property and enum member initializer #34892

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

Merged
merged 3 commits into from
Nov 15, 2019

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Nov 3, 2019

Fixes #34887

Disallows await and yield in class property initializers.
yield is now allowed in computed names (if you ignore A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.).
Removes some special handling for parsing yield in static property initializers. An error was added in Checker anyway.

Disallows await and yield in enum declarations. Since enums are transpiled to IIFEs, they don't inherit the context from the containing function.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Code changes look fine to me. @rbuckton do the changes match your understanding of async/await?

@rbuckton rbuckton merged commit 5321dcb into microsoft:master Nov 15, 2019
elibarzilay added a commit to elibarzilay/TypeScript that referenced this pull request Nov 15, 2019
Also, drop the other cases where they were ignored, since they're
forbidden in enums, and the others are fine wrt the comment that was
there.

Fixes microsoft#34892
elibarzilay added a commit to elibarzilay/TypeScript that referenced this pull request Nov 20, 2019
Also, drop the other cases where they were ignored, since they're
forbidden in enums, and the others are fine wrt the comment that was
there.

Fixes microsoft#34892
elibarzilay added a commit to elibarzilay/TypeScript that referenced this pull request Nov 21, 2019
Also, drop the other cases where they were ignored, since they're
forbidden in enums, and the others are fine wrt the comment that was
there.

Fixes microsoft#34892
elibarzilay added a commit that referenced this pull request Nov 22, 2019
Also, drop the other cases where they were ignored, since they're
forbidden in enums, and the others are fine wrt the comment that was
there.

Fixes #34892
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.

Invalid await is generated in constructor when initializing field
4 participants