remove IfStatement making consequent and alternate blocks

This commit is contained in:
Sebastian McKenzie 2014-11-03 11:17:36 +11:00
parent 3cd7ed69a3
commit e13a650d05

View File

@ -15,14 +15,12 @@ exports.IfStatement = function (node, print) {
print(node.test);
this.push(") ");
var consequent = node.consequent;
if (node.alternate) consequent = t.toBlock(consequent);
print(consequent);
print(node.consequent);
if (node.alternate) {
if (this.isLast("}")) this.push(" ");
this.keyword("else");
print(t.toBlock(node.alternate));
print(node.alternate);
}
};
@ -159,15 +157,13 @@ exports.SwitchCase = function (node, print) {
this.push("default:");
}
this.indent();
if (node.consequent.length === 1) {
this.push(" ");
print(node.consequent[0]);
} else if (node.consequent.length > 1) {
this.newline();
print.sequence(node.consequent);
print.sequence(node.consequent, { indent: true });
}
this.dedent();
};
exports.DebuggerStatement = function () {