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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit parens for await of ternary expressions #5270

Merged
merged 1 commit into from Feb 6, 2017

Conversation

erikdesjardins
Copy link
Contributor

@erikdesjardins erikdesjardins commented Feb 6, 2017

Q A
Patch: Bug Fix? yes
Major: Breaking Change? no
Minor: New Feature? no
Deprecations? no
Spec Compliancy?
Tests Added/Pass? yes
Fixed Tickets fixes #5269
License MIT
Doc PR no
Dependency Changes no

The await expression:
await 1 ? 2 : 3 is equivalent to:
(await 1) ? 2 : 3 so parens must be emitted for:
await (1 ? 2 : 3)

Bizarrely, this is not the same as yield expressions, where:
yield 1 ? 2 : 3 is equivalent to:
yield (1 ? 2 : 3) and not equivalent to:
(yield 1) ? 2 : 3

I have no idea why the spec is like this 馃槙

@mention-bot
Copy link

@erikdesjardins, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hzoo, @existentialism and @bjouhier to be potential reviewers.

@existentialism existentialism added pkg: generator PR: Bug Fix 馃悰 A type of pull request used for our changelog categories labels Feb 6, 2017
@loganfsmyth loganfsmyth merged commit e9d7757 into babel:master Feb 6, 2017
@erikdesjardins erikdesjardins deleted the await-ternary branch February 6, 2017 17:08
@hzoo
Copy link
Member

hzoo commented Feb 15, 2017

btw @erikdesjardins I know you're probably busy with RES and other things, but would you like to be added as a collaborator on our team? We'd love to have you

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: generator PR: Bug Fix 馃悰 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parens are not emitted for await of ternary expression
5 participants