Merge pull request #2607 from amasad/extra-paren-return
It's safe not to parenthesize SequenceExpressions in ReturnStatements
This commit is contained in:
commit
7d60bcbcb6
@ -139,6 +139,10 @@ export function SequenceExpression(node, parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.isReturnStatement(parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise err on the side of overparenthesization, adding
|
||||
// explicit exceptions above if this proves overzealous.
|
||||
return true;
|
||||
|
||||
@ -5,3 +5,7 @@ function foo() {
|
||||
function bar() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
function foo() {
|
||||
return 1, "foo";
|
||||
}
|
||||
|
||||
@ -5,3 +5,7 @@ function foo() {
|
||||
function bar() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
function foo() {
|
||||
return 1, "foo";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user