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 | |
package com.sun.tools.javafx.tree; |
27 | |
|
28 | |
import com.sun.javafx.api.tree.ForExpressionInClauseTree; |
29 | |
import com.sun.source.tree.Tree; |
30 | |
import com.sun.tools.javac.tree.JCTree; |
31 | |
import com.sun.tools.javac.tree.JCTree.JCBlock; |
32 | |
import com.sun.tools.javac.tree.JCTree.JCExpression; |
33 | |
import com.sun.tools.javac.tree.TreeScanner; |
34 | |
import com.sun.tools.javac.util.List; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | 12 | public class JavafxTreeScanner extends TreeScanner implements JavafxVisitor { |
47 | |
|
48 | 4918 | public JavafxTreeScanner() { |
49 | 4918 | } |
50 | |
|
51 | |
|
52 | |
|
53 | |
@Override |
54 | |
public void scan(JCTree tree) { |
55 | 169897 | if(tree!=null) tree.accept(this); |
56 | 169897 | } |
57 | |
|
58 | |
|
59 | |
|
60 | |
@Override |
61 | |
public void scan(List<? extends JCTree> trees) { |
62 | 34124 | if (trees != null) |
63 | 68611 | for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail) |
64 | 34487 | scan(l.head); |
65 | 34124 | } |
66 | |
|
67 | |
|
68 | |
|
69 | |
public void scan(java.util.List<? extends Tree> trees) { |
70 | 0 | if (trees != null) |
71 | 0 | for (Tree t : trees) |
72 | 0 | scan((JCTree)t); |
73 | 0 | } |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
@Override |
82 | |
public void visitClassDeclaration(JFXClassDeclaration that) { |
83 | 1634 | scan(that.mods); |
84 | 1634 | for (Tree member : that.getMembers()) { |
85 | 4908 | scan((JCTree)member); |
86 | |
} |
87 | 1634 | } |
88 | |
|
89 | |
@Override |
90 | |
public void visitFunctionValue(JFXFunctionValue tree) { |
91 | 4570 | for (JFXVar param : tree.getParams()) { |
92 | 3986 | scan(param); |
93 | |
} |
94 | 4570 | scan(tree.getBodyExpression()); |
95 | 4570 | } |
96 | |
|
97 | |
@Override |
98 | |
public void visitFunctionDefinition(JFXFunctionDefinition tree) { |
99 | 2810 | scan(tree.getModifiers()); |
100 | 2810 | scan(tree.getJFXReturnType()); |
101 | 2810 | visitFunctionValue(tree.operation); |
102 | 2810 | } |
103 | |
|
104 | |
@Override |
105 | |
public void visitInitDefinition(JFXInitDefinition that) { |
106 | 150 | scan((JCBlock)that.getBody()); |
107 | 150 | } |
108 | |
|
109 | |
public void visitPostInitDefinition(JFXPostInitDefinition that) { |
110 | 50 | scan((JCBlock)that.getBody()); |
111 | 50 | } |
112 | |
|
113 | |
@Override |
114 | |
public void visitSequenceEmpty(JFXSequenceEmpty that) { |
115 | 216 | } |
116 | |
|
117 | |
@Override |
118 | |
public void visitSequenceRange(JFXSequenceRange that) { |
119 | 839 | scan( that.getLower() ); |
120 | 839 | scan( that.getUpper() ); |
121 | 839 | scan( that.getStepOrNull() ); |
122 | 839 | } |
123 | |
|
124 | |
@Override |
125 | |
public void visitSequenceExplicit(JFXSequenceExplicit that) { |
126 | 1588 | scan( that.getItems() ); |
127 | 1588 | } |
128 | |
|
129 | |
@Override |
130 | |
public void visitSequenceIndexed(JFXSequenceIndexed that) { |
131 | 1979 | scan(that.getSequence()); |
132 | 1979 | scan(that.getIndex()); |
133 | 1979 | } |
134 | |
|
135 | |
public void visitSequenceSlice(JFXSequenceSlice that) { |
136 | 265 | scan(that.getSequence()); |
137 | 265 | scan(that.getFirstIndex()); |
138 | 265 | scan(that.getLastIndex()); |
139 | 265 | } |
140 | |
|
141 | |
@Override |
142 | |
public void visitSequenceInsert(JFXSequenceInsert that) { |
143 | 930 | scan(that.getSequence()); |
144 | 930 | scan(that.getElement()); |
145 | 930 | } |
146 | |
|
147 | |
@Override |
148 | |
public void visitSequenceDelete(JFXSequenceDelete that) { |
149 | 615 | scan(that.getSequence()); |
150 | 615 | scan(that.getElement()); |
151 | 615 | } |
152 | |
|
153 | |
@Override |
154 | |
public void visitStringExpression(JFXStringExpression that) { |
155 | 2959 | List<JCExpression> parts = that.getParts(); |
156 | 2959 | parts = parts.tail; |
157 | 7623 | while (parts.nonEmpty()) { |
158 | 4664 | parts = parts.tail; |
159 | 4664 | scan(parts.head); |
160 | 4664 | parts = parts.tail; |
161 | 4664 | parts = parts.tail; |
162 | |
} |
163 | 2959 | } |
164 | |
|
165 | |
@Override |
166 | |
public void visitInstanciate(JFXInstanciate tree) { |
167 | 2560 | scan(tree.getIdentifier()); |
168 | 2560 | scan(tree.getArgs()); |
169 | 2560 | scan(tree.getParts()); |
170 | 2560 | scan(tree.getLocalvars()); |
171 | 2560 | scan(tree.getClassBody()); |
172 | 2560 | } |
173 | |
|
174 | |
@Override |
175 | |
public void visitSetAttributeToObjectBeingInitialized(JFXSetAttributeToObjectBeingInitialized that) { |
176 | 0 | } |
177 | |
|
178 | |
@Override |
179 | |
public void visitObjectLiteralPart(JFXObjectLiteralPart that) { |
180 | 2203 | scan(that.getExpression()); |
181 | 2203 | } |
182 | |
|
183 | |
@Override |
184 | |
public void visitTypeAny(JFXTypeAny that) { |
185 | 0 | } |
186 | |
|
187 | |
@Override |
188 | |
public void visitTypeClass(JFXTypeClass that) { |
189 | 7297 | } |
190 | |
|
191 | |
@Override |
192 | |
public void visitTypeFunctional(JFXTypeFunctional that) { |
193 | 102 | for (JCTree param : (List<JFXType>)that.getParameters()) { |
194 | 90 | scan(param); |
195 | |
} |
196 | 102 | scan((JFXType)that.getReturnType()); |
197 | 102 | } |
198 | |
|
199 | |
@Override |
200 | |
public void visitTypeUnknown(JFXTypeUnknown that) { |
201 | 5610 | } |
202 | |
|
203 | |
@Override |
204 | |
public void visitVar(JFXVar tree) { |
205 | 9376 | scan(tree.getJFXType()); |
206 | 9376 | scan(tree.mods); |
207 | 9376 | scan(tree.init); |
208 | 9376 | scan(tree.getOnReplace()); |
209 | 9376 | } |
210 | |
|
211 | |
@Override |
212 | |
public void visitOverrideAttribute(JFXOverrideAttribute tree) { |
213 | 51 | scan(tree.getId()); |
214 | 51 | scan(tree.getInitializer()); |
215 | 51 | scan(tree.getOnReplace()); |
216 | 51 | } |
217 | |
|
218 | |
@Override |
219 | |
public void visitOnReplace(JFXOnReplace tree) { |
220 | 506 | scan(tree.getFirstIndex()); |
221 | 506 | scan(tree.getOldValue()); |
222 | 506 | scan(tree.getBody()); |
223 | 506 | scan(tree.getLastIndex()); |
224 | 506 | scan(tree.getNewElements()); |
225 | 506 | } |
226 | |
|
227 | |
|
228 | |
@Override |
229 | |
public void visitForExpression(JFXForExpression that) { |
230 | 789 | for (ForExpressionInClauseTree cl : that.getInClauses()) { |
231 | 821 | JFXForExpressionInClause clause = (JFXForExpressionInClause)cl; |
232 | 821 | scan(clause); |
233 | 821 | } |
234 | 789 | scan(that.getBodyExpression()); |
235 | 789 | } |
236 | |
|
237 | |
@Override |
238 | |
public void visitForExpressionInClause(JFXForExpressionInClause that) { |
239 | 821 | scan(that.getVar()); |
240 | 821 | scan(that.getSequenceExpression()); |
241 | 821 | scan(that.getWhereExpression()); |
242 | 821 | } |
243 | |
|
244 | |
@Override |
245 | |
public void visitBindExpression(JFXBindExpression that) { |
246 | 4 | scan(that.expr); |
247 | 4 | } |
248 | |
|
249 | |
@Override |
250 | |
public void visitBlockExpression(JFXBlockExpression that) { |
251 | 5396 | scan(that.stats); |
252 | 5396 | scan(that.value); |
253 | 5396 | } |
254 | |
|
255 | |
@Override |
256 | |
public void visitIndexof(JFXIndexof that) { |
257 | 111 | } |
258 | |
|
259 | |
@Override |
260 | |
public void visitTree(JCTree that) { |
261 | 0 | assert false : "Should not be here!!!"; |
262 | 0 | } |
263 | |
|
264 | |
public void visitTimeLiteral(JFXTimeLiteral tree) { |
265 | 89 | } |
266 | |
|
267 | |
public void visitInterpolate(JFXInterpolate that) { |
268 | 0 | scan(that.var); |
269 | 0 | scan(that.values); |
270 | 0 | } |
271 | |
|
272 | |
public void visitInterpolateValue(JFXInterpolateValue that) { |
273 | 20 | scan(that.attribute); |
274 | 20 | scan(that.value); |
275 | 20 | } |
276 | |
|
277 | |
public void visitKeyFrameLiteral(JFXKeyFrameLiteral that) { |
278 | 0 | scan(that.start); |
279 | 0 | scan(that.exprs); |
280 | 0 | scan(that.trigger); |
281 | 0 | } |
282 | |
} |