This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 package IR.Tree;
2 import IR.TypeDescriptor;
3
4 public class CastNode extends ExpressionNode  {
5   TypeDescriptor td;
6   ExpressionNode etd;
7   ExpressionNode exp;
8
9   public CastNode(TypeDescriptor type, ExpressionNode exp) {
10     this.td=type;
11     this.exp=exp;
12     this.etd=null;
13   }
14
15   public CastNode(ExpressionNode type, ExpressionNode exp) {
16     this.td=null;
17     this.exp=exp;
18     this.etd=type;
19   }
20
21   public TypeDescriptor getType() {
22     return td;
23   }
24
25   public ExpressionNode getExpression() {
26     return exp;
27   }
28
29   public void setType(TypeDescriptor td) {
30     this.td=td;
31   }
32
33   public NameNode getTypeName() {
34     return (NameNode) etd;
35   }
36
37   public String printNode(int indentlevel) {
38     if (etd==null)
39       return "("+td.toString()+")"+exp.printNode(indentlevel);
40     else
41       return "("+etd.printNode(indentlevel)+")"+exp.printNode(indentlevel);
42   }
43
44   public int kind() {
45     return Kind.CastNode;
46   }
47 }