Skip to content

Commit

Permalink
Wrap some generated do expressions in parens (#5339)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjmiller authored and hzoo committed Feb 22, 2017
1 parent be293bd commit 6614a63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/babel-generator/src/node/parentheses.js
Expand Up @@ -46,6 +46,10 @@ export function ObjectExpression(node: Object, parent: Object, printStack: Array
return isFirstInStatement(printStack, { considerArrow: true });
}

export function DoExpression(node: Object, parent: Object, printStack: Array<Object>): boolean {
return isFirstInStatement(printStack);
}

export function Binary(node: Object, parent: Object): boolean {
if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {
return true;
Expand Down
@@ -0,0 +1,3 @@
(do {
foo;
});
@@ -0,0 +1,3 @@
(do {
foo;
});

0 comments on commit 6614a63

Please sign in to comment.