New braces style

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@206 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent acfe14f7af
commit c68e14fc05
  1. 19
      jode/jode/flow/IfThenElseBlock.java

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

Loading…
Cancel
Save