better handle spaces in IfStatement generator

This commit is contained in:
Sebastian McKenzie 2015-02-04 08:40:23 +11:00
parent 7a0dbb0203
commit e8dc4628ae

View File

@ -23,7 +23,11 @@ exports.IfStatement = function (node, print) {
if (node.alternate) {
if (this.isLast("}")) this.push(" ");
this.keyword("else");
this.push(" ");
if (this.format.format && !t.isBlockStatement(node.alternate)) {
this.push(" ");
}
print.indentOnComments(node.alternate);
}
};