bug in cast code
[IRC.git] / Robust / src / IR / Tree / CastNode.java
index d9dc92765a97437b3dcaa679c16c55f97f2335e3..e7e41c5f29094a0beb209be51c503e9866dc736c 100644 (file)
@@ -2,26 +2,46 @@ package IR.Tree;
 import IR.TypeDescriptor;
 
 public class CastNode extends ExpressionNode  {
-    TypeDescriptor td;
-    ExpressionNode etd;
-    ExpressionNode exp;
-
-    public CastNode(TypeDescriptor type, ExpressionNode exp) {
-       this.td=type;
-       this.exp=exp;
-       this.etd=null;
-    }
-
-    public CastNode(ExpressionNode type, ExpressionNode exp) {
-       this.td=null;
-       this.exp=exp;
-       this.etd=type;
-    }
-
-    public String printNode(int indentlevel) {
-       if (etd==null)
-           return "("+td.toString()+")"+exp.printNode(indentlevel);
-       else
-           return "("+etd.printNode(indentlevel)+")"+exp.printNode(indentlevel);
-    }
+  TypeDescriptor td;
+  ExpressionNode etd;
+  ExpressionNode exp;
+
+  public CastNode(TypeDescriptor type, ExpressionNode exp) {
+    this.td=type;
+    this.exp=exp;
+    this.etd=null;
+  }
+
+  public CastNode(ExpressionNode type, ExpressionNode exp) {
+    this.td=null;
+    this.exp=exp;
+    this.etd=type;
+  }
+
+  public TypeDescriptor getType() {
+    return td;
+  }
+
+  public ExpressionNode getExpression() {
+    return exp;
+  }
+
+  public void setType(TypeDescriptor td) {
+    this.td=td;
+  }
+
+  public NameNode getTypeName() {
+    return (NameNode) etd;
+  }
+
+  public String printNode(int indentlevel) {
+    if (etd==null)
+      return "("+td.toString()+")"+exp.printNode(indentlevel);
+    else
+      return "("+etd.printNode(indentlevel)+")"+exp.printNode(indentlevel);
+  }
+
+  public int kind() {
+    return Kind.CastNode;
+  }
 }