Parens are needed unless it's a logical expression

This commit is contained in:
Amjad Masad 2015-10-27 18:09:48 -07:00
parent f9c923b87f
commit 382c0d9c1a

View File

@ -97,6 +97,11 @@ export function Binary(node, parent) {
if (parentPos > nodePos) { if (parentPos > nodePos) {
return true; return true;
} }
// Logical expressions with the same precedence don't need parens.
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {
return true;
}
} }
} }