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 DSpecialInvokeExpr extends GSpecialInvokeExpr 29 { 30 public DSpecialInvokeExpr( 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( methodRef.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 67 public String toString() 68 { 69 if (getBase().getType() instanceof NullType) { 70 StringBuffer b = new StringBuffer (); 71 72 b.append( "(("); 73 b.append( methodRef.declaringClass().getJavaStyleName()); 74 b.append( ") "); 75 76 String baseStr = ( getBase()).toString(); 77 if ((getBase() instanceof Precedence) && ( ((Precedence) getBase()).getPrecedence() < getPrecedence())) 78 baseStr = "(" + baseStr + ")"; 79 80 b.append( baseStr); 81 b.append( ")."); 82 83 b.append( methodRef.name()); 84 b.append( "("); 85 86 for (int i=0; i<argBoxes.length; i++) { 87 if(i != 0) 88 b.append(", "); 89 90 b.append( ( argBoxes[i].getValue()).toString()); 91 } 92 93 b.append(")"); 94 95 return b.toString(); 96 } 97 98 return super.toString(); 99 } 100 101 public Object clone() 102 { 103 ArrayList clonedArgs = new ArrayList( getArgCount()); 104 105 for(int i = 0; i < getArgCount(); i++) 106 clonedArgs.add(i, Grimp.cloneIfNecessary(getArg(i))); 107 108 return new DSpecialInvokeExpr( getBase(), methodRef, clonedArgs); 109 } 110 } 111 | Popular Tags |