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 DInterfaceInvokeExpr extends GInterfaceInvokeExpr 29 { 30 public DInterfaceInvokeExpr( Value base, SootMethodRef methodRef, java.util.List args) 31 { 32 super( base, methodRef, args); 33 } 34 35 public void toString( UnitPrinter up ) { 36 if (getBase().getType() instanceof NullType) { 37 up.literal( "((" ); 40 up.type( getMethodRef().declaringClass().getType() ); 41 up.literal( ") " ); 42 43 if( PrecedenceTest.needsBrackets( baseBox, this ) ) up.literal("("); 44 baseBox.toString( up ); 45 if( PrecedenceTest.needsBrackets( baseBox, this ) ) up.literal(")"); 46 47 up.literal( ")" ); 48 up.literal( "." ); 49 50 up.methodRef( methodRef ); 51 up.literal( "(" ); 52 53 for (int i=0; i<argBoxes.length; i++) { 54 if(i != 0) 55 up.literal( ", " ); 56 57 argBoxes[i].toString(up); 58 } 59 60 up.literal( ")" ); 61 } else { 62 super.toString( up ); 63 } 64 } 65 66 public String toString() 67 { 68 if (getBase().getType() instanceof NullType) { 69 StringBuffer b = new StringBuffer (); 70 71 b.append( "(("); 72 b.append( getMethodRef().declaringClass().getJavaStyleName()); 73 b.append( ") "); 74 75 String baseStr = ( getBase()).toString(); 76 if ((getBase() instanceof Precedence) && ( ((Precedence) getBase()).getPrecedence() < getPrecedence())) 77 baseStr = "(" + baseStr + ")"; 78 79 b.append( baseStr); 80 b.append( ")."); 81 82 b.append( getMethodRef().name()); 83 b.append( "("); 84 85 for (int i=0; i<argBoxes.length; i++) { 86 if(i != 0) 87 b.append(", "); 88 89 b.append( ( argBoxes[i].getValue()).toString()); 90 } 91 92 b.append(")"); 93 94 return b.toString(); 95 } 96 97 return super.toString(); 98 } 99 100 public Object clone() 101 { 102 ArrayList clonedArgs = new ArrayList( getArgCount()); 103 104 for(int i = 0; i < getArgCount(); i++) 105 clonedArgs.add(i, Grimp.cloneIfNecessary(getArg(i))); 106 107 return new DInterfaceInvokeExpr( getBase(), methodRef, clonedArgs); 108 } 109 } 110 | Popular Tags |