|
|
@ -97,13 +97,18 @@ public class IfThenElseBlock extends StructuredBlock { |
|
|
|
throws java.io.IOException |
|
|
|
throws java.io.IOException |
|
|
|
{ |
|
|
|
{ |
|
|
|
boolean needBrace = thenBlock.needsBraces(); |
|
|
|
boolean needBrace = thenBlock.needsBraces(); |
|
|
|
writer.println("if ("+cond.simplify().toString()+")" |
|
|
|
writer.print("if ("+cond.simplify().toString()+")"); |
|
|
|
+(needBrace?" {":"")); |
|
|
|
if (needBrace) |
|
|
|
|
|
|
|
writer.openBrace(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
writer.println(); |
|
|
|
writer.tab(); |
|
|
|
writer.tab(); |
|
|
|
thenBlock.dumpSource(writer); |
|
|
|
thenBlock.dumpSource(writer); |
|
|
|
writer.untab(); |
|
|
|
writer.untab(); |
|
|
|
if (elseBlock != null) { |
|
|
|
if (elseBlock != null) { |
|
|
|
writer.print(needBrace ? "} " : ""); |
|
|
|
if (needBrace) |
|
|
|
|
|
|
|
writer.closeBraceContinue(); |
|
|
|
|
|
|
|
|
|
|
|
if (elseBlock instanceof IfThenElseBlock |
|
|
|
if (elseBlock instanceof IfThenElseBlock |
|
|
|
&& (elseBlock.declare == null |
|
|
|
&& (elseBlock.declare == null |
|
|
|
|| elseBlock.declare.isEmpty())) { |
|
|
|
|| elseBlock.declare.isEmpty())) { |
|
|
@ -112,14 +117,18 @@ public class IfThenElseBlock extends StructuredBlock { |
|
|
|
elseBlock.dumpSource(writer); |
|
|
|
elseBlock.dumpSource(writer); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
needBrace = elseBlock.needsBraces(); |
|
|
|
needBrace = elseBlock.needsBraces(); |
|
|
|
writer.println("else" + (needBrace ? " {" : "")); |
|
|
|
writer.print("else"); |
|
|
|
|
|
|
|
if (needBrace) |
|
|
|
|
|
|
|
writer.openBrace(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
writer.println(); |
|
|
|
writer.tab(); |
|
|
|
writer.tab(); |
|
|
|
elseBlock.dumpSource(writer); |
|
|
|
elseBlock.dumpSource(writer); |
|
|
|
writer.untab(); |
|
|
|
writer.untab(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (needBrace) |
|
|
|
if (needBrace) |
|
|
|
writer.println("}"); |
|
|
|
writer.closeBrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|