new braces style

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@204 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 60f3ddda89
commit cf1ef397e5
  1. 11
      jode/jode/flow/CaseBlock.java
  2. 6
      jode/jode/flow/CatchBlock.java
  3. 4
      jode/jode/flow/FinallyBlock.java

@ -131,22 +131,25 @@ public class CaseBlock extends StructuredBlock {
&& subBlock instanceof EmptyBlock && subBlock instanceof EmptyBlock
&& subBlock.jump == null) && subBlock.jump == null)
return; return;
writer.println("default:" + (wantBraces ? " {" : "")); writer.print("default:");
} else { } else {
ConstOperator constOp = new ConstOperator ConstOperator constOp = new ConstOperator
(((SwitchBlock)outer).getInstruction().getType(), (((SwitchBlock)outer).getInstruction().getType(),
Integer.toString(value)); Integer.toString(value));
constOp.makeInitializer(); constOp.makeInitializer();
writer.println("case " + constOp.toString() + ":" writer.print("case " + constOp.toString() + ":");
+ (wantBraces ? " {" : ""));
} }
if (wantBraces)
writer.openBrace();
else
writer.println();
if (subBlock != null) { if (subBlock != null) {
writer.tab(); writer.tab();
subBlock.dumpSource(writer); subBlock.dumpSource(writer);
writer.untab(); writer.untab();
} }
if (wantBraces) if (wantBraces)
writer.println("}"); writer.closeBrace();
} }
/** /**

@ -104,8 +104,10 @@ public class CatchBlock extends StructuredBlock {
public void dumpInstruction(jode.TabbedPrintWriter writer) public void dumpInstruction(jode.TabbedPrintWriter writer)
throws java.io.IOException { throws java.io.IOException {
writer.println("} catch ("+exceptionType.toString() + " " writer.closeBraceContinue();
+ exceptionLocal.getName().toString()+ ") {"); writer.print("catch ("+exceptionType.toString() + " "
+ exceptionLocal.getName().toString()+ ")");
writer.openBrace();
writer.tab(); writer.tab();
catchBlock.dumpSource(writer); catchBlock.dumpSource(writer);
writer.untab(); writer.untab();

@ -46,7 +46,9 @@ public class FinallyBlock extends CatchBlock {
public void dumpInstruction(jode.TabbedPrintWriter writer) public void dumpInstruction(jode.TabbedPrintWriter writer)
throws java.io.IOException { throws java.io.IOException {
writer.println("} finally {"); writer.closeBraceContinue();
writer.print("finally");
writer.openBrace();
writer.tab(); writer.tab();
catchBlock.dumpSource(writer); catchBlock.dumpSource(writer);
writer.untab(); writer.untab();

Loading…
Cancel
Save