1 19 20 package jode.expr; 21 import jode.type.Type; 22 import jode.decompiler.TabbedPrintWriter; 23 24 public class InstanceOfOperator extends Operator { 25 26 Type instanceType; 27 28 public InstanceOfOperator(Type type) { 29 super(Type.tBoolean, 0); 30 this.instanceType = type; 31 initOperands(1); 32 } 33 34 public int getPriority() { 35 return 550; 36 } 37 38 public void updateSubTypes() { 39 subExpressions[0].setType(Type.tUObject); 40 } 41 42 public void updateType() { 43 } 44 45 public void dumpExpression(TabbedPrintWriter writer) 46 throws java.io.IOException { 47 51 Type superType 52 = instanceType.getCastHelper(subExpressions[0].getType()); 53 if (superType != null) { 54 writer.startOp(writer.IMPL_PAREN, 2); 55 writer.print("("); 56 writer.printType(superType); 57 writer.print(") "); 58 writer.breakOp(); 59 subExpressions[0].dumpExpression(writer, 700); 60 writer.endOp(); 61 } else 62 subExpressions[0].dumpExpression(writer, 550); 63 writer.breakOp(); 64 writer.print(" instanceof "); 65 writer.printType(instanceType); 66 } 67 } 68 | Popular Tags |