|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| package koala.dynamicjava.tree; |
|
30 |
| |
|
31 |
| import java.util.*; |
|
32 |
| |
|
33 |
| import edu.rice.cs.plt.tuple.Option; |
|
34 |
| |
|
35 |
| import koala.dynamicjava.tree.visitor.*; |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| public class InnerAllocation extends PrimaryExpression implements StatementExpression, ExpressionContainer { |
|
45 |
| private Expression expression; |
|
46 |
| private Option<List<TypeName>> typeArgs; |
|
47 |
| private String className; |
|
48 |
| private Option<List<TypeName>> classTypeArgs; |
|
49 |
| private List<Expression> arguments; |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
0
| public InnerAllocation(Expression exp, Option<List<TypeName>> targs, String cn,
|
|
61 |
| Option<List<TypeName>> ctargs, List<? extends Expression> args) { |
|
62 |
0
| this(exp, targs, cn, ctargs, args, SourceInfo.NONE);
|
|
63 |
| } |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
1
| public InnerAllocation(Expression exp, String cn, Option<List<TypeName>> ctargs, List<? extends Expression> args) {
|
|
74 |
1
| this(exp, Option.<List<TypeName>>none(), cn, ctargs, args, SourceInfo.NONE);
|
|
75 |
| } |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
0
| public InnerAllocation(Expression exp, String cn, Option<List<TypeName>> ctargs, List<? extends Expression> args,
|
|
86 |
| SourceInfo si) { |
|
87 |
0
| this(exp, Option.<List<TypeName>>none(), cn, ctargs, args, si);
|
|
88 |
| } |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
2
| public InnerAllocation(Expression exp, Option<List<TypeName>> targs, String cn,
|
|
100 |
| Option<List<TypeName>> ctargs, List<? extends Expression> args, |
|
101 |
| SourceInfo si) { |
|
102 |
2
| super(si);
|
|
103 |
0
| if (targs == null || cn == null || ctargs == null || exp == null) throw new IllegalArgumentException();
|
|
104 |
2
| expression = exp;
|
|
105 |
2
| typeArgs = targs;
|
|
106 |
2
| className = cn;
|
|
107 |
2
| classTypeArgs = ctargs;
|
|
108 |
2
| arguments = (args == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(args);
|
|
109 |
| } |
|
110 |
| |
|
111 |
| |
|
112 |
| |
|
113 |
| |
|
114 |
2
| public Expression getExpression() {
|
|
115 |
2
| return expression;
|
|
116 |
| } |
|
117 |
| |
|
118 |
| |
|
119 |
| |
|
120 |
| |
|
121 |
| |
|
122 |
0
| public void setExpression(Expression e) {
|
|
123 |
0
| if (e == null) throw new IllegalArgumentException("e == null");
|
|
124 |
0
| expression = e;
|
|
125 |
| } |
|
126 |
| |
|
127 |
2
| public Option<List<TypeName>> getTypeArgs() { return typeArgs; }
|
|
128 |
0
| public void setTypeArgs(List<TypeName> targs) { typeArgs = Option.wrap(targs); }
|
|
129 |
0
| public void setTypeArgs(Option<List<TypeName>> targs) {
|
|
130 |
0
| if (targs == null) throw new IllegalArgumentException();
|
|
131 |
0
| typeArgs = targs;
|
|
132 |
| } |
|
133 |
| |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
2
| public String getClassName() {
|
|
138 |
2
| return className;
|
|
139 |
| } |
|
140 |
| |
|
141 |
| |
|
142 |
| |
|
143 |
| |
|
144 |
| |
|
145 |
0
| public void setClassName(String cn) {
|
|
146 |
0
| if (cn == null) throw new IllegalArgumentException("cn == null");
|
|
147 |
0
| className = cn;
|
|
148 |
| } |
|
149 |
| |
|
150 |
2
| public Option<List<TypeName>> getClassTypeArgs() { return classTypeArgs; }
|
|
151 |
0
| public void setClassTypeArgs(List<TypeName> ctargs) { classTypeArgs = Option.wrap(ctargs); }
|
|
152 |
0
| public void setClassTypeArgs(Option<List<TypeName>> ctargs) {
|
|
153 |
0
| if (ctargs == null) throw new IllegalArgumentException();
|
|
154 |
0
| classTypeArgs = ctargs;
|
|
155 |
| } |
|
156 |
| |
|
157 |
| |
|
158 |
| |
|
159 |
| |
|
160 |
| |
|
161 |
2
| public List<Expression> getArguments() {
|
|
162 |
2
| return arguments;
|
|
163 |
| } |
|
164 |
| |
|
165 |
| |
|
166 |
| |
|
167 |
| |
|
168 |
0
| public void setArguments(List<? extends Expression> l) {
|
|
169 |
0
| arguments = (l == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(l);
|
|
170 |
| } |
|
171 |
| |
|
172 |
| |
|
173 |
| |
|
174 |
| |
|
175 |
| |
|
176 |
0
| public <T> T acceptVisitor(Visitor<T> visitor) {
|
|
177 |
0
| return visitor.visit(this);
|
|
178 |
| } |
|
179 |
| |
|
180 |
| |
|
181 |
| |
|
182 |
2
| public String toString() {
|
|
183 |
2
| return "("+getClass().getName()+": "+getTypeArgs()+" "+getClassName()+" "+getClassTypeArgs()+" "+
|
|
184 |
| getExpression()+" "+getArguments()+")"; |
|
185 |
| } |
|
186 |
| } |