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

Microbouji patch/8136 #9073

Merged
merged 3 commits into from Nov 24, 2018
Merged

Conversation

jridgewell
Copy link
Member

Q                       A
Fixed Issues? Fixes #8136, closes #8210
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR
Any Dependency Changes?
License MIT

Currently when proposal-optional-chaining transforms

a?.b()

into

(_a = a) === null || _a === void 0 ? void 0 : _a.b()

that last _a.b() is technically an OptionalCallExpression with no optional field set.

This PR changes it to be just a CallExpression. I believe this is how it should be, and this also enables other plugins (like transform-spread) who use CallExpression in their visitors to keep working.


This supersedes #8210, and fixes deeply nested optional call expressions. I've reused the original commits from that PR.

microbouji and others added 3 commits November 23, 2018 18:32
Instead of going both upwards and downwards from the first real optional expression, we can just start from the top down.
@jridgewell jridgewell added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Optional Chaining labels Nov 24, 2018
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9440/

@babel babel deleted a comment from babel-bot Nov 24, 2018
@henrikra
Copy link

henrikra commented Dec 2, 2018

Are guys using VsCode when your code has optional chain syntax? How well does it work in your editor? Does it mess up editor syntax highlighting?

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 PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Optional Chaining
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spread-operator doesn't transform to ES5
5 participants