1 19 20 package jode.flow; 21 import jode.decompiler.TabbedPrintWriter; 22 23 26 public class BreakBlock extends StructuredBlock { 27 StructuredBlock breaksBlock; 28 String label; 29 30 public BreakBlock(BreakableBlock breaksBlock, boolean needsLabel) { 31 this.breaksBlock = (StructuredBlock) breaksBlock; 32 breaksBlock.setBreaked(); 33 if (needsLabel) 34 label = breaksBlock.getLabel(); 35 else 36 label = null; 37 } 38 39 public void checkConsistent() { 40 super.checkConsistent(); 41 StructuredBlock sb = outer; 42 while (sb != breaksBlock) { 43 if (sb == null) 44 throw new RuntimeException ("Inconsistency"); 45 sb = sb.outer; 46 } 47 } 48 49 52 public boolean isEmpty() { 53 return true; 54 } 55 56 60 public StructuredBlock getNextBlock() { 61 return breaksBlock.getNextBlock(); 62 } 63 64 71 public FlowBlock getNextFlowBlock() { 72 return breaksBlock.getNextFlowBlock(); 73 } 74 75 82 public VariableStack mapStackToLocal(VariableStack stack) { 83 ((BreakableBlock)breaksBlock).mergeBreakedStack(stack); 84 return null; 85 } 86 87 91 public boolean needsBraces() { 92 return false; 93 } 94 95 public void dumpInstruction(TabbedPrintWriter writer) 96 throws java.io.IOException 97 { 98 writer.println("break"+(label == null ? "" : " "+label) + ";"); 99 } 100 101 public boolean jumpMayBeChanged() { 102 return true; 103 } 104 } 105 | Popular Tags |