Fix various print inefficiencies/bugs

This commit is contained in:
Amjad Masad
2015-12-27 01:23:45 -08:00
parent fd998cb9af
commit ed5a057e4e
6 changed files with 58 additions and 2 deletions

View File

@@ -123,6 +123,22 @@ export function SequenceExpression(node: Object, parent: Object): boolean {
return false;
}
if (t.isSwitchStatement(parent) && parent.discriminant === node) {
return false;
}
if (t.isWhileStatement(parent) && parent.test === node) {
return false;
}
if (t.isIfStatement(parent) && parent.test === node) {
return false;
}
if (t.isForInStatement(parent) && parent.right === node) {
return false;
}
// Otherwise err on the side of overparenthesization, adding
// explicit exceptions above if this proves overzealous.
return true;