This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 package IR.Tree;
2 import java.util.Vector;
3 import IR.TypeDescriptor;
4 import IR.MethodDescriptor;
5
6 public class CreateObjectNode extends ExpressionNode {
7   TypeDescriptor td;
8   Vector argumentlist;
9   MethodDescriptor md;
10   FlagEffects fe;
11   boolean isglobal;
12
13   public CreateObjectNode(TypeDescriptor type, boolean isglobal) {
14     td=type;
15     argumentlist=new Vector();
16     this.isglobal=isglobal;
17   }
18
19   public boolean isGlobal() {
20     return isglobal;
21   }
22
23   public void addFlagEffects(FlagEffects fe) {
24     this.fe=fe;
25   }
26
27   public FlagEffects getFlagEffects() {
28     return fe;
29   }
30
31   public void addArgument(ExpressionNode en) {
32     argumentlist.add(en);
33   }
34
35   public void setConstructor(MethodDescriptor md) {
36     this.md=md;
37   }
38
39   public MethodDescriptor getConstructor() {
40     return md;
41   }
42
43   public TypeDescriptor getType() {
44     return td;
45   }
46
47   public int numArgs() {
48     return argumentlist.size();
49   }
50
51   public ExpressionNode getArg(int i) {
52     return (ExpressionNode) argumentlist.get(i);
53   }
54
55   public String printNode(int indent) {
56     String st;
57     boolean isarray=td.isArray();
58     if (isarray)
59       st="new "+td.toString()+"[";
60     else
61       st="new "+td.toString()+"(";
62     for(int i=0; i<argumentlist.size(); i++) {
63       ExpressionNode en=(ExpressionNode)argumentlist.get(i);
64       st+=en.printNode(indent);
65       if ((i+1)!=argumentlist.size()) {
66         if (isarray)
67           st+="][";
68         else
69           st+=", ";
70       }
71     }
72     if (isarray)
73       return st+"]";
74     else
75       return st+")";
76   }
77
78   public int kind() {
79     return Kind.CreateObjectNode;
80   }
81 }