1 19 20 package jode.expr; 21 import jode.type.Type; 22 import jode.decompiler.LocalInfo; 23 import jode.decompiler.TabbedPrintWriter; 24 25 import java.util.Collection ; 26 27 43 44 public class CheckNullOperator extends Operator { 45 LocalInfo local; 46 47 public CheckNullOperator(Type type, LocalInfo li) { 48 super(type, 0); 49 local = li; 50 initOperands(1); 51 } 52 53 public int getPriority() { 54 return 200; 55 } 56 57 public void updateSubTypes() { 58 local.setType(type); 59 subExpressions[0].setType(Type.tSubType(type)); 60 } 61 62 public void updateType() { 63 Type newType = Type.tSuperType(subExpressions[0].getType()) 64 .intersection(type); 65 local.setType(newType); 66 updateParentType(newType); 67 } 68 69 public void removeLocal() { 70 local.remove(); 71 } 72 73 public void fillInGenSet(Collection in, Collection gen) { 74 if (gen != null) 75 gen.add(local); 76 super.fillInGenSet(in, gen); 77 } 78 79 public void fillDeclarables(Collection used) { 80 used.add(local); 81 super.fillDeclarables(used); 82 } 83 84 public void dumpExpression(TabbedPrintWriter writer) 85 throws java.io.IOException { 86 writer.print("("+local.getName()+" = "); 87 subExpressions[0].dumpExpression(writer, 0); 88 writer.print(").getClass() != null ? "+local.getName()+" : null"); 89 } 90 91 public boolean opEquals(Operator o) { 92 return o instanceof CheckNullOperator; 93 } 94 } 95 | Popular Tags |