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