mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 03:02:19 +00:00
Fixed: Better looking code generation with correct indentation for 'if' - 'else if' statements
This commit is contained in:
1 parent
689ab09555
commit
e35bfaf96c
1 file changed
+7
-5
@@ -572,14 +572,16 @@ IfStatement: function(node, st, c) {
|
||||
indentation += indentStep;
|
||||
c(node.consequent, st, "Statement");
|
||||
indentation = indentation.substring(indentationSpaces);
|
||||
if (node.alternate) {
|
||||
var alternate = node.alternate;
|
||||
if (alternate) {
|
||||
var alternateNotIf = alternate.type !== "IfStatement";
|
||||
if (generate) {
|
||||
CONCAT(buffer, indentation);
|
||||
CONCAT(buffer, "else\n");
|
||||
CONCAT(buffer, alternateNotIf ? "else\n" : "else ");
|
||||
}
|
||||
indentation += indentStep;
|
||||
c(node.alternate, st, "Statement");
|
||||
indentation = indentation.substring(indentationSpaces);
|
||||
if (alternateNotIf) indentation += indentStep;
|
||||
c(alternate, st, "Statement");
|
||||
if (alternateNotIf) indentation = indentation.substring(indentationSpaces);
|
||||
}
|
||||
},
|
||||
LabeledStatement: function(node, st, c) {
|
||||
|
||||
Reference in new issue
Block a user