1 19 20 package jode.flow; 21 import jode.decompiler.LocalInfo; 22 import jode.expr.Expression; 23 import jode.expr.InvokeOperator; 24 import jode.expr.LocalVarOperator; 25 import jode.util.SimpleSet; 26 27 import java.util.Set ; 28 29 32 public abstract class InstructionContainer extends StructuredBlock { 33 36 Expression instr; 37 38 public InstructionContainer(Expression instr) { 39 this.instr = instr; 40 } 41 42 public InstructionContainer(Expression instr, Jump jump) { 43 this(instr); 44 setJump(jump); 45 } 46 47 57 public void makeDeclaration(Set done) { 58 if (instr != null) 59 instr.makeDeclaration(done); 60 super.makeDeclaration(done); 61 } 62 63 72 public void removeOnetimeLocals() { 73 if (instr != null) 74 instr = instr.removeOnetimeLocals(); 75 super.removeOnetimeLocals(); 76 } 77 78 82 public void fillInGenSet(Set in, Set gen) { 83 if (instr != null) 84 instr.fillInGenSet(in, gen); 85 } 86 87 public Set getDeclarables() { 88 Set used = new SimpleSet(); 89 if (instr != null) 90 instr.fillDeclarables(used); 91 return used; 92 } 93 94 public boolean doTransformations() { 95 if (instr == null) 96 return false; 97 100 if (instr instanceof InvokeOperator) { 101 Expression expr = ((InvokeOperator)instr).simplifyAccess(); 102 if (expr != null) 103 instr = expr; 104 } 105 StructuredBlock last = flowBlock.lastModified; 106 return CreateNewConstructor.transform(this, last) 107 || CreateAssignExpression.transform(this, last) 108 || CreateExpression.transform(this, last) 109 || CreatePrePostIncExpression.transform(this, last) 110 || CreateIfThenElseOperator.create(this, last) 111 || CreateConstantArray.transform(this, last) 112 || CreateCheckNull.transformJavac(this, last); 113 } 114 115 119 public final Expression getInstruction() { 120 return instr; 121 } 122 123 public void simplify() { 124 if (instr != null) 125 instr = instr.simplify(); 126 super.simplify(); 127 } 128 129 133 public final void setInstruction(Expression instr) { 134 this.instr = instr; 135 } 136 } 137 | Popular Tags |