Conversation
|
@lucivpav I just ran into this issue too. Lines 946 to 949 in ab53cd5 this should be var strExpr = expr.toString();
if (strExpr[0] === '{' || strExpr[strExpr.length - 1] === '}') {
expr = ['(', expr, ')'];
}I'm pretty sure the last character cannot be part of the comment, in that case the comment would not be part of the node |
|
I wonder if this fix works for the affected parenthesized expressions in general, or just in function bodies 🤔 |
|
@lucivpav a better solution is to check the node types: if (node.type === Syntax.ArrowFunctionExpression && node.body.type === Syntax.ObjectExpression) {
expr = ['(', expr, ')'];
} |
|
@lucivpav This PR does not cover this scenario: |
|
@Itazulay my new PR is implementing it properly IMO |
Reproduces #426