1 19 20 package soot; 21 import soot.jimple.*; 22 import java.util.*; 23 24 27 public class NormalUnitPrinter extends LabeledUnitPrinter { 28 public NormalUnitPrinter( Body body ) { 29 super(body); 30 } 31 32 public void type( Type t ) { 33 handleIndent(); 34 String s = t.toString(); 35 if( t instanceof RefType ) s = Scene.v().quotedNameOf(s); 36 output.append( s ); 37 } 38 public void methodRef( SootMethodRef m ) { 39 handleIndent(); 40 output.append( m.getSignature() ); 41 } 42 public void fieldRef( SootFieldRef f ) { 43 handleIndent(); 44 output.append(f.getSignature()); 45 } 46 public void identityRef( IdentityRef r ) { 47 handleIndent(); 48 if( r instanceof ThisRef ) { 49 literal("@this: "); 50 type(r.getType()); 51 } else if( r instanceof ParameterRef ) { 52 ParameterRef pr = (ParameterRef) r; 53 literal("@parameter"+pr.getIndex()+": "); 54 type(r.getType()); 55 } else if( r instanceof CaughtExceptionRef ) { 56 literal("@caughtexception"); 57 } else throw new RuntimeException (); 58 } 59 public void literal( String s ) { 60 handleIndent(); 61 output.append( s ); 62 } 63 } 64 65 66 | Popular Tags |