1 20 21 package soot.dava.internal.javaRep; 22 23 import soot.*; 24 import java.util.*; 25 import soot.grimp.*; 26 import soot.grimp.internal.*; 27 28 public class DVirtualInvokeExpr extends GVirtualInvokeExpr 29 { 30 private HashSet thisLocals; 31 32 public DVirtualInvokeExpr( Value base, SootMethodRef methodRef, java.util.List args, HashSet thisLocals) 33 { 34 super( base, methodRef, args); 35 36 this.thisLocals = thisLocals; 37 } 38 39 public void toString( UnitPrinter up ) { 40 if (getBase().getType() instanceof NullType) { 41 up.literal( "((" ); 44 up.type( methodRef.declaringClass().getType() ); 45 up.literal( ") " ); 46 47 if( PrecedenceTest.needsBrackets( baseBox, this ) ) up.literal("("); 48 baseBox.toString( up ); 49 if( PrecedenceTest.needsBrackets( baseBox, this ) ) up.literal(")"); 50 51 up.literal( ")" ); 52 up.literal( "." ); 53 54 up.methodRef( methodRef ); 55 up.literal( "(" ); 56 57 for (int i=0; i<argBoxes.length; i++) { 58 if(i != 0) 59 up.literal( ", " ); 60 61 argBoxes[i].toString(up); 62 } 63 64 up.literal( ")" ); 65 } else { 66 super.toString( up ); 67 } 68 } 69 70 71 public String toString() 72 { 73 if (getBase().getType() instanceof NullType) { 74 StringBuffer b = new StringBuffer (); 75 76 b.append( "(("); 77 b.append( methodRef.declaringClass().getJavaStyleName()); 78 b.append( ") "); 79 80 String baseStr = ( getBase()).toString(); 81 if ((getBase() instanceof Precedence) && ( ((Precedence) getBase()).getPrecedence() < getPrecedence())) 82 baseStr = "(" + baseStr + ")"; 83 84 b.append( baseStr); 85 b.append( ")."); 86 87 b.append( methodRef.name()); 88 b.append( "("); 89 90 for (int i=0; i<argBoxes.length; i++) { 91 if(i != 0) 92 b.append(", "); 93 94 b.append( ( argBoxes[i].getValue()).toString()); 95 } 96 97 b.append(")"); 98 99 return b.toString(); 100 } 101 102 return super.toString(); 103 } 104 105 public Object clone() 106 { 107 ArrayList clonedArgs = new ArrayList( getArgCount()); 108 109 for(int i = 0; i < getArgCount(); i++) 110 clonedArgs.add(i, Grimp.cloneIfNecessary(getArg(i))); 111 112 return new DVirtualInvokeExpr(Grimp.cloneIfNecessary(getBase()), methodRef, clonedArgs, thisLocals); 113 } 114 } 115 | Popular Tags |