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
Print parentheses around identifier let
where necessary
#13269
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45877/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1aea906:
|
Ah, I just remembered that OptionalMemberExpression can also print a left bracket if I don't think this can occur in head position in a freshly-parsed AST, but it can occur if a transform rearranges nodes and also sets Adding the appropriate check is easy enough, but I'll need to write a non-fixture test to get coverage. |
Ideally we should add some validation to ensure that |
Thanks! |
If we detect that the identifier
let
would be printed in a location that forbids it (either unconditionally or when followed by[
), print parentheses around the identifier so that it remains legal and correct.The forbidden locations are:
let [
)let [
)let [
)let
) (regular andawait
)