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
Unify parens printing for postfix-like expressions #11382
Conversation
@@ -32,6 +32,15 @@ const isClassExtendsClause = (node: Object, parent: Object): boolean => | |||
(t.isClassDeclaration(parent) || t.isClassExpression(parent)) && | |||
parent.superClass === node; | |||
|
|||
const isPostfixExpression = (node: Object, parent: Object) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK the postfix expression is used to describe a way of how the operator and its operands are arranged, so I am confused about the term here.
The Spec provides a term LeftHandSideExpression
and I think we can stick with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LeftHandSideExpression
doesn't work, because it also covers PrimaryExpression
.
I initially called this "postfix" because TS's !
is a postfix operator, and because in foo()
and foo.bar
, ()
and .bar
are "postfixes" of the main foo
expression 😅
Maybe hasPostfixPart
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with hasPostfixPart
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for me 🌝
...()
, ...[0]
, ...!
and template tags
...()
, ...[0]
, ...!
and template tags
This blocks #10961