1 19 20 25 26 27 28 29 30 31 package soot.jimple.internal; 32 33 import soot.*; 34 import soot.tagkit.*; 35 36 import soot.jimple.*; 37 import soot.baf.*; 38 import soot.jimple.*; 39 import soot.util.*; 40 import java.util.*; 41 42 public class JReturnStmt extends AbstractStmt implements ReturnStmt 43 { 44 ValueBox returnValueBox; 45 46 public JReturnStmt(Value returnValue) 47 { 48 this(Jimple.v().newImmediateBox(returnValue)); 49 } 50 51 protected JReturnStmt(ValueBox returnValueBox) 52 { 53 this.returnValueBox = returnValueBox; 54 } 55 56 public Object clone() 57 { 58 return new JReturnStmt(Jimple.cloneIfNecessary(getOp())); 59 } 60 61 public String toString() 62 { 63 return Jimple.v().RETURN + " " + returnValueBox.getValue().toString(); 64 } 65 66 public void toString( UnitPrinter up) { 67 up.literal(Jimple.v().RETURN); 68 up.literal(" "); 69 returnValueBox.toString(up); 70 } 71 72 public ValueBox getOpBox() 73 { 74 return returnValueBox; 75 } 76 77 public void setOp(Value returnValue) 78 { 79 returnValueBox.setValue(returnValue); 80 } 81 82 public Value getOp() 83 { 84 return returnValueBox.getValue(); 85 } 86 87 public List getUseBoxes() 88 { 89 List useBoxes = new ArrayList(); 90 91 useBoxes.addAll(returnValueBox.getValue().getUseBoxes()); 92 useBoxes.add(returnValueBox); 93 94 return useBoxes; 95 } 96 97 public void apply(Switch sw) 98 { 99 ((StmtSwitch) sw).caseReturnStmt(this); 100 } 101 102 public void convertToBaf(JimpleToBafContext context, List out) 103 { 104 ((ConvertToBaf)(getOp())).convertToBaf(context, out); 105 106 107 Unit u; 108 out.add(u = Baf.v().newReturnInst(getOp().getType())); 109 110 Unit currentUnit = this; 111 112 Iterator it = currentUnit.getTags().iterator(); 113 while(it.hasNext()) { 114 u.addTag((Tag) it.next()); 115 } 116 } 117 118 119 public boolean fallsThrough(){return false;} 120 public boolean branches(){return false;} 121 122 123 } 124 125 | Popular Tags |