Avoid calls to isUserWhitespacable by explicitly marking statement lists.

This commit is contained in:
Logan Smyth 2016-07-16 15:20:00 -07:00
parent 38b91235cc
commit 5de7433147
4 changed files with 3 additions and 7 deletions

View File

@ -251,6 +251,7 @@ export function ObjectTypeAnnotation(node: Object) {
this.printJoin(props, node, {
indent: true,
statement: true,
iterator: () => {
if (props.length !== 1) {
this.semicolon();

View File

@ -38,7 +38,7 @@ export function ObjectExpression(node: Object) {
if (props.length) {
this.space();
this.printList(props, node, { indent: true });
this.printList(props, node, { indent: true, statement: true });
this.space();
}

View File

@ -53,11 +53,6 @@ function isOrHasCallExpression(node) {
}
}
export function isUserWhitespacable(node) {
return t.isUserWhitespacable(node);
}
export function needsWhitespace(node, parent, type) {
if (!node) return 0;

View File

@ -448,7 +448,7 @@ export default class Printer {
// Fast path since 'this.newline' does nothing when not tracking lines.
if (this.format.retainLines || this.format.compact) return;
if (!opts.statement && !n.isUserWhitespacable(node, parent)) {
if (!opts.statement) {
return;
}