remove IfStatement making consequent and alternate blocks
This commit is contained in:
parent
3cd7ed69a3
commit
e13a650d05
@ -15,14 +15,12 @@ exports.IfStatement = function (node, print) {
|
|||||||
print(node.test);
|
print(node.test);
|
||||||
this.push(") ");
|
this.push(") ");
|
||||||
|
|
||||||
var consequent = node.consequent;
|
print(node.consequent);
|
||||||
if (node.alternate) consequent = t.toBlock(consequent);
|
|
||||||
print(consequent);
|
|
||||||
|
|
||||||
if (node.alternate) {
|
if (node.alternate) {
|
||||||
if (this.isLast("}")) this.push(" ");
|
if (this.isLast("}")) this.push(" ");
|
||||||
this.keyword("else");
|
this.keyword("else");
|
||||||
print(t.toBlock(node.alternate));
|
print(node.alternate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,15 +157,13 @@ exports.SwitchCase = function (node, print) {
|
|||||||
this.push("default:");
|
this.push("default:");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.indent();
|
|
||||||
if (node.consequent.length === 1) {
|
if (node.consequent.length === 1) {
|
||||||
this.push(" ");
|
this.push(" ");
|
||||||
print(node.consequent[0]);
|
print(node.consequent[0]);
|
||||||
} else if (node.consequent.length > 1) {
|
} else if (node.consequent.length > 1) {
|
||||||
this.newline();
|
this.newline();
|
||||||
print.sequence(node.consequent);
|
print.sequence(node.consequent, { indent: true });
|
||||||
}
|
}
|
||||||
this.dedent();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.DebuggerStatement = function () {
|
exports.DebuggerStatement = function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user