new brace style

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@213 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent b264c0e8a8
commit 0cb4e7e046
  1. 16
      jode/jode/flow/LoopBlock.java
  2. 5
      jode/jode/flow/SwitchBlock.java
  3. 11
      jode/jode/flow/SynchronizedBlock.java
  4. 5
      jode/jode/flow/TryBlock.java

@ -253,15 +253,19 @@ public class LoopBlock extends StructuredBlock implements BreakableBlock {
+incr.getInstruction().simplify().toString()+")"); +incr.getInstruction().simplify().toString()+")");
break; break;
} }
writer.println( needBrace?" {": ""); if (needBrace)
writer.openBrace();
else
writer.println();
writer.tab(); writer.tab();
bodyBlock.dumpSource(writer); bodyBlock.dumpSource(writer);
writer.untab(); writer.untab();
if (type == DOWHILE) if (type == DOWHILE) {
writer.println((needBrace?"} ": "")+ if (needBrace)
"while ("+cond.simplify().toString()+");"); writer.closeBraceContinue();
else if (needBrace) writer.println("while ("+cond.simplify().toString()+");");
writer.println("}"); } else if (needBrace)
writer.closeBrace();
} }

@ -134,10 +134,11 @@ implements BreakableBlock {
writer.println(label+":"); writer.println(label+":");
writer.tab(); writer.tab();
} }
writer.println("switch ("+instr.simplify()+") {"); writer.print("switch ("+instr.simplify()+")");
writer.openBrace();
for (int i=0; i < caseBlocks.length; i++) for (int i=0; i < caseBlocks.length; i++)
caseBlocks[i].dumpSource(writer); caseBlocks[i].dumpSource(writer);
writer.println("}"); writer.closeBrace();
} }
/** /**

@ -82,14 +82,15 @@ public class SynchronizedBlock extends StructuredBlock {
{ {
if (!isEntered) if (!isEntered)
writer.println("MISSING MONITORENTER"); writer.println("MISSING MONITORENTER");
writer.println("synchronized (" writer.print("synchronized ("
+ (object != null + (object != null
? object.simplify().toString() ? object.simplify().toString()
: local.getName()) + ") {"); : local.getName()) + ")");
writer.openBrace();
writer.tab(); writer.tab();
bodyBlock.dumpSource(writer); bodyBlock.dumpSource(writer);
writer.untab(); writer.untab();
writer.println("}"); writer.closeBrace();
} }
public boolean doTransformations() { public boolean doTransformations() {

@ -92,13 +92,14 @@ public class TryBlock extends StructuredBlock {
public void dumpInstruction(TabbedPrintWriter writer) public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException { throws java.io.IOException {
writer.println("try {"); writer.print("try");
writer.openBrace();
writer.tab(); writer.tab();
subBlocks[0].dumpSource(writer); subBlocks[0].dumpSource(writer);
writer.untab(); writer.untab();
for (int i=1; i<subBlocks.length;i++) for (int i=1; i<subBlocks.length;i++)
subBlocks[i].dumpSource(writer); subBlocks[i].dumpSource(writer);
writer.println("}"); writer.closeBrace();
} }
/** /**

Loading…
Cancel
Save