author | sundar |
Thu, 28 Jun 2018 18:04:19 +0530 | |
changeset 50878 | fb7800b66c92 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
29407 | 1 |
/* |
39662
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
29407 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.nashorn.api.tree; |
|
27 |
||
28 |
/** |
|
29 |
* Common interface for all nodes in an abstract syntax tree. |
|
30 |
* |
|
31 |
* <p><b>WARNING:</b> This interface and its sub-interfaces are |
|
32 |
* subject to change as the ECMAScript programming language evolves. |
|
33 |
* |
|
50878
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
34 |
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool |
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
35 |
* are deprecated with the intent to remove them in a future release. |
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
36 |
* |
35325
7624a7d7e661
8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents:
34903
diff
changeset
|
37 |
* @since 9 |
29407 | 38 |
*/ |
50878
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
39 |
@Deprecated(since="11", forRemoval=true) |
29407 | 40 |
public interface Tree { |
41 |
||
42 |
/** |
|
43 |
* Enumerates all kinds of trees. |
|
50878
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
44 |
* |
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
45 |
* @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool |
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
46 |
* are deprecated with the intent to remove them in a future release. |
29407 | 47 |
*/ |
50878
fb7800b66c92
8204492: Add deprecation annotation to Nashorn APIs and warning to nashorn, jjs
sundar
parents:
47216
diff
changeset
|
48 |
@Deprecated(since="11", forRemoval=true) |
29407 | 49 |
public enum Kind { |
50 |
/** |
|
51 |
* Used for instances of {@link ArrayAccessTree}. |
|
52 |
*/ |
|
53 |
ARRAY_ACCESS(ArrayAccessTree.class), |
|
54 |
||
55 |
/** |
|
56 |
* Used for instances of {@link ArrayLiteralTree}. |
|
57 |
*/ |
|
58 |
ARRAY_LITERAL(ArrayLiteralTree.class), |
|
59 |
||
60 |
/** |
|
61 |
* Used for instances of {@link AssignmentTree}. |
|
62 |
*/ |
|
63 |
ASSIGNMENT(AssignmentTree.class), |
|
64 |
||
65 |
/** |
|
66 |
* Used for instances of {@link BlockTree}. |
|
67 |
*/ |
|
68 |
BLOCK(BlockTree.class), |
|
69 |
||
70 |
/** |
|
71 |
* Used for instances of {@link BreakTree}. |
|
72 |
*/ |
|
73 |
BREAK(BreakTree.class), |
|
74 |
||
75 |
/** |
|
39662
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
76 |
* Used for instances of {@link ClassDeclarationTree}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
77 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
78 |
CLASS(ClassDeclarationTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
79 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
80 |
/** |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
81 |
* Used for instances of {@link ClassExpressionTree}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
82 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
83 |
CLASS_EXPRESSION(ClassExpressionTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
84 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
85 |
/** |
29407 | 86 |
* Used for instances of {@link CaseTree}. |
87 |
*/ |
|
88 |
CASE(CaseTree.class), |
|
89 |
||
90 |
/** |
|
91 |
* Used for instances of {@link CatchTree}. |
|
92 |
*/ |
|
93 |
CATCH(CatchTree.class), |
|
94 |
||
95 |
/** |
|
96 |
* Used for instances of {@link CompilationUnitTree}. |
|
97 |
*/ |
|
98 |
COMPILATION_UNIT(CompilationUnitTree.class), |
|
99 |
||
100 |
/** |
|
101 |
* Used for instances of {@link ConditionalExpressionTree}. |
|
102 |
*/ |
|
103 |
CONDITIONAL_EXPRESSION(ConditionalExpressionTree.class), |
|
104 |
||
105 |
/** |
|
106 |
* Used for instances of {@link ContinueTree}. |
|
107 |
*/ |
|
108 |
CONTINUE(ContinueTree.class), |
|
109 |
||
110 |
/** |
|
111 |
* Used for instances of {@link DoWhileLoopTree}. |
|
112 |
*/ |
|
113 |
DO_WHILE_LOOP(DoWhileLoopTree.class), |
|
114 |
||
115 |
/** |
|
116 |
* Used for instances of {@link DebuggerTree}. |
|
117 |
*/ |
|
118 |
DEBUGGER(DebuggerTree.class), |
|
119 |
||
120 |
/** |
|
121 |
* Used for instances of {@link ForInLoopTree}. |
|
122 |
*/ |
|
123 |
FOR_IN_LOOP(ForInLoopTree.class), |
|
124 |
||
125 |
/** |
|
126 |
* Used for instances of {@link FunctionExpressionTree}. |
|
127 |
*/ |
|
128 |
FUNCTION_EXPRESSION(FunctionExpressionTree.class), |
|
129 |
||
130 |
/** |
|
131 |
* Used for instances of {@link ErroneousTree}. |
|
132 |
*/ |
|
133 |
ERROR(ErroneousTree.class), |
|
134 |
||
135 |
/** |
|
136 |
* Used for instances of {@link ExpressionStatementTree}. |
|
137 |
*/ |
|
138 |
EXPRESSION_STATEMENT(ExpressionStatementTree.class), |
|
139 |
||
140 |
/** |
|
141 |
* Used for instances of {@link MemberSelectTree}. |
|
142 |
*/ |
|
143 |
MEMBER_SELECT(MemberSelectTree.class), |
|
144 |
||
145 |
/** |
|
146 |
* Used for instances of {@link ForLoopTree}. |
|
147 |
*/ |
|
148 |
FOR_LOOP(ForLoopTree.class), |
|
149 |
||
150 |
/** |
|
151 |
* Used for instances of {@link IdentifierTree}. |
|
152 |
*/ |
|
153 |
IDENTIFIER(IdentifierTree.class), |
|
154 |
||
155 |
/** |
|
156 |
* Used for instances of {@link IfTree}. |
|
157 |
*/ |
|
158 |
IF(IfTree.class), |
|
159 |
||
160 |
/** |
|
161 |
* Used for instances of {@link InstanceOfTree}. |
|
162 |
*/ |
|
163 |
INSTANCE_OF(InstanceOfTree.class), |
|
164 |
||
165 |
/** |
|
166 |
* Used for instances of {@link LabeledStatementTree}. |
|
167 |
*/ |
|
168 |
LABELED_STATEMENT(LabeledStatementTree.class), |
|
169 |
||
170 |
/** |
|
39662
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
171 |
* Used for instances of {@link ModuleTree}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
172 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
173 |
MODULE(ModuleTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
174 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
175 |
/** |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
176 |
* Used for instances of {@link ExportEntryTree}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
177 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
178 |
EXPORT_ENTRY(ExportEntryTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
179 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
180 |
/** |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
181 |
* Used for instances of {@link ImportEntryTree}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
182 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
183 |
IMPORT_ENTRY(ImportEntryTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
184 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
185 |
/** |
29407 | 186 |
* Used for instances of {@link FunctionDeclarationTree}. |
187 |
*/ |
|
188 |
FUNCTION(FunctionDeclarationTree.class), |
|
189 |
||
190 |
/** |
|
191 |
* Used for instances of {@link FunctionCallTree}. |
|
192 |
*/ |
|
193 |
FUNCTION_INVOCATION(FunctionCallTree.class), |
|
194 |
||
195 |
/** |
|
196 |
* Used for instances of {@link NewTree}. |
|
197 |
*/ |
|
198 |
NEW(NewTree.class), |
|
199 |
||
200 |
/** |
|
201 |
* Used for instances of {@link ObjectLiteralTree}. |
|
202 |
*/ |
|
203 |
OBJECT_LITERAL(ObjectLiteralTree.class), |
|
204 |
||
205 |
/** |
|
206 |
* Used for instances of {@link ParenthesizedTree}. |
|
207 |
*/ |
|
208 |
PARENTHESIZED(ParenthesizedTree.class), |
|
209 |
||
210 |
/** |
|
211 |
* Used for instances of {@link PropertyTree}. |
|
212 |
*/ |
|
213 |
PROPERTY(PropertyTree.class), |
|
214 |
||
215 |
/** |
|
216 |
* Used for instances of {@link RegExpLiteralTree}. |
|
217 |
*/ |
|
218 |
REGEXP_LITERAL(RegExpLiteralTree.class), |
|
219 |
||
220 |
/** |
|
39662
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
221 |
* Used for instances of {@link TemplateLiteralTree}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
222 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
223 |
TEMPLATE_LITERAL(TemplateLiteralTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
224 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
225 |
/** |
29407 | 226 |
* Used for instances of {@link ReturnTree}. |
227 |
*/ |
|
228 |
RETURN(ReturnTree.class), |
|
229 |
||
230 |
/** |
|
231 |
* Used for instances of {@link EmptyStatementTree}. |
|
232 |
*/ |
|
233 |
EMPTY_STATEMENT(EmptyStatementTree.class), |
|
234 |
||
235 |
/** |
|
236 |
* Used for instances of {@link SwitchTree}. |
|
237 |
*/ |
|
238 |
SWITCH(SwitchTree.class), |
|
239 |
||
240 |
/** |
|
241 |
* Used for instances of {@link ThrowTree}. |
|
242 |
*/ |
|
243 |
THROW(ThrowTree.class), |
|
244 |
||
245 |
/** |
|
246 |
* Used for instances of {@link TryTree}. |
|
247 |
*/ |
|
248 |
TRY(TryTree.class), |
|
249 |
||
250 |
/** |
|
251 |
* Used for instances of {@link VariableTree}. |
|
252 |
*/ |
|
253 |
VARIABLE(VariableTree.class), |
|
254 |
||
255 |
/** |
|
256 |
* Used for instances of {@link WhileLoopTree}. |
|
257 |
*/ |
|
258 |
WHILE_LOOP(WhileLoopTree.class), |
|
259 |
||
260 |
/** |
|
261 |
* Used for instances of {@link WithTree}. |
|
262 |
*/ |
|
263 |
WITH(WithTree.class), |
|
264 |
||
265 |
/** |
|
266 |
* Used for instances of {@link UnaryTree} representing postfix |
|
267 |
* increment operator {@code ++}. |
|
268 |
*/ |
|
269 |
POSTFIX_INCREMENT(UnaryTree.class), |
|
270 |
||
271 |
/** |
|
272 |
* Used for instances of {@link UnaryTree} representing postfix |
|
273 |
* decrement operator {@code --}. |
|
274 |
*/ |
|
275 |
POSTFIX_DECREMENT(UnaryTree.class), |
|
276 |
||
277 |
/** |
|
278 |
* Used for instances of {@link UnaryTree} representing prefix |
|
279 |
* increment operator {@code ++}. |
|
280 |
*/ |
|
281 |
PREFIX_INCREMENT(UnaryTree.class), |
|
282 |
||
283 |
/** |
|
284 |
* Used for instances of {@link UnaryTree} representing prefix |
|
285 |
* decrement operator {@code --}. |
|
286 |
*/ |
|
287 |
PREFIX_DECREMENT(UnaryTree.class), |
|
288 |
||
289 |
/** |
|
290 |
* Used for instances of {@link UnaryTree} representing unary plus |
|
291 |
* operator {@code +}. |
|
292 |
*/ |
|
293 |
UNARY_PLUS(UnaryTree.class), |
|
294 |
||
295 |
/** |
|
296 |
* Used for instances of {@link UnaryTree} representing unary minus |
|
297 |
* operator {@code -}. |
|
298 |
*/ |
|
299 |
UNARY_MINUS(UnaryTree.class), |
|
300 |
||
301 |
/** |
|
302 |
* Used for instances of {@link UnaryTree} representing bitwise |
|
303 |
* complement operator {@code ~}. |
|
304 |
*/ |
|
305 |
BITWISE_COMPLEMENT(UnaryTree.class), |
|
306 |
||
307 |
/** |
|
308 |
* Used for instances of {@link UnaryTree} representing logical |
|
309 |
* complement operator {@code !}. |
|
310 |
*/ |
|
311 |
LOGICAL_COMPLEMENT(UnaryTree.class), |
|
312 |
||
313 |
/** |
|
314 |
* Used for instances of {@link UnaryTree} representing logical |
|
315 |
* delete operator {@code delete}. |
|
316 |
*/ |
|
317 |
DELETE(UnaryTree.class), |
|
318 |
||
319 |
/** |
|
320 |
* Used for instances of {@link UnaryTree} representing logical |
|
321 |
* typeof operator {@code typeof}. |
|
322 |
*/ |
|
323 |
TYPEOF(UnaryTree.class), |
|
324 |
||
325 |
/** |
|
326 |
* Used for instances of {@link UnaryTree} representing logical |
|
39662
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
327 |
* void operator {@code void}. |
29407 | 328 |
*/ |
329 |
VOID(UnaryTree.class), |
|
330 |
||
331 |
/** |
|
332 |
* Used for instances of {@link BinaryTree} representing |
|
333 |
* comma {@code ,}. |
|
334 |
*/ |
|
335 |
COMMA(BinaryTree.class), |
|
336 |
||
337 |
/** |
|
338 |
* Used for instances of {@link BinaryTree} representing |
|
339 |
* multiplication {@code *}. |
|
340 |
*/ |
|
341 |
MULTIPLY(BinaryTree.class), |
|
342 |
||
343 |
/** |
|
344 |
* Used for instances of {@link BinaryTree} representing |
|
345 |
* division {@code /}. |
|
346 |
*/ |
|
347 |
DIVIDE(BinaryTree.class), |
|
348 |
||
349 |
/** |
|
350 |
* Used for instances of {@link BinaryTree} representing |
|
351 |
* remainder {@code %}. |
|
352 |
*/ |
|
353 |
REMAINDER(BinaryTree.class), |
|
354 |
||
355 |
/** |
|
356 |
* Used for instances of {@link BinaryTree} representing |
|
357 |
* addition or string concatenation {@code +}. |
|
358 |
*/ |
|
359 |
PLUS(BinaryTree.class), |
|
360 |
||
361 |
/** |
|
362 |
* Used for instances of {@link BinaryTree} representing |
|
363 |
* subtraction {@code -}. |
|
364 |
*/ |
|
365 |
MINUS(BinaryTree.class), |
|
366 |
||
367 |
/** |
|
368 |
* Used for instances of {@link BinaryTree} representing |
|
369 |
* left shift {@code <<}. |
|
370 |
*/ |
|
371 |
LEFT_SHIFT(BinaryTree.class), |
|
372 |
||
373 |
/** |
|
374 |
* Used for instances of {@link BinaryTree} representing |
|
375 |
* right shift {@code >>}. |
|
376 |
*/ |
|
377 |
RIGHT_SHIFT(BinaryTree.class), |
|
378 |
||
379 |
/** |
|
380 |
* Used for instances of {@link BinaryTree} representing |
|
381 |
* unsigned right shift {@code >>>}. |
|
382 |
*/ |
|
383 |
UNSIGNED_RIGHT_SHIFT(BinaryTree.class), |
|
384 |
||
385 |
/** |
|
386 |
* Used for instances of {@link BinaryTree} representing |
|
387 |
* less-than {@code <}. |
|
388 |
*/ |
|
389 |
LESS_THAN(BinaryTree.class), |
|
390 |
||
391 |
/** |
|
392 |
* Used for instances of {@link BinaryTree} representing |
|
393 |
* greater-than {@code >}. |
|
394 |
*/ |
|
395 |
GREATER_THAN(BinaryTree.class), |
|
396 |
||
397 |
/** |
|
398 |
* Used for instances of {@link BinaryTree} representing |
|
399 |
* less-than-equal {@code <=}. |
|
400 |
*/ |
|
401 |
LESS_THAN_EQUAL(BinaryTree.class), |
|
402 |
||
403 |
/** |
|
404 |
* Used for instances of {@link BinaryTree} representing |
|
405 |
* greater-than-equal {@code >=}. |
|
406 |
*/ |
|
407 |
GREATER_THAN_EQUAL(BinaryTree.class), |
|
408 |
||
409 |
/** |
|
410 |
* Used for instances of {@link BinaryTree} representing |
|
411 |
* in operator {@code in}. |
|
412 |
*/ |
|
413 |
IN(BinaryTree.class), |
|
414 |
||
415 |
/** |
|
416 |
* Used for instances of {@link BinaryTree} representing |
|
417 |
* equal-to {@code ==}. |
|
418 |
*/ |
|
419 |
EQUAL_TO(BinaryTree.class), |
|
420 |
||
421 |
/** |
|
422 |
* Used for instances of {@link BinaryTree} representing |
|
423 |
* not-equal-to {@code !=}. |
|
424 |
*/ |
|
425 |
NOT_EQUAL_TO(BinaryTree.class), |
|
426 |
||
427 |
/** |
|
428 |
* Used for instances of {@link BinaryTree} representing |
|
429 |
* equal-to {@code ===}. |
|
430 |
*/ |
|
431 |
STRICT_EQUAL_TO(BinaryTree.class), |
|
432 |
||
433 |
/** |
|
434 |
* Used for instances of {@link BinaryTree} representing |
|
435 |
* not-equal-to {@code !==}. |
|
436 |
*/ |
|
437 |
STRICT_NOT_EQUAL_TO(BinaryTree.class), |
|
438 |
||
439 |
/** |
|
440 |
* Used for instances of {@link BinaryTree} representing |
|
441 |
* bitwise and logical "and" {@code &}. |
|
442 |
*/ |
|
443 |
AND(BinaryTree.class), |
|
444 |
||
445 |
/** |
|
446 |
* Used for instances of {@link BinaryTree} representing |
|
447 |
* bitwise and logical "xor" {@code ^}. |
|
448 |
*/ |
|
449 |
XOR(BinaryTree.class), |
|
450 |
||
451 |
/** |
|
452 |
* Used for instances of {@link BinaryTree} representing |
|
453 |
* bitwise and logical "or" {@code |}. |
|
454 |
*/ |
|
455 |
OR(BinaryTree.class), |
|
456 |
||
457 |
/** |
|
458 |
* Used for instances of {@link BinaryTree} representing |
|
459 |
* conditional-and {@code &&}. |
|
460 |
*/ |
|
461 |
CONDITIONAL_AND(BinaryTree.class), |
|
462 |
||
463 |
/** |
|
464 |
* Used for instances of {@link BinaryTree} representing |
|
465 |
* conditional-or {@code ||}. |
|
466 |
*/ |
|
467 |
CONDITIONAL_OR(BinaryTree.class), |
|
468 |
||
469 |
/** |
|
470 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
471 |
* multiplication assignment {@code *=}. |
|
472 |
*/ |
|
473 |
MULTIPLY_ASSIGNMENT(CompoundAssignmentTree.class), |
|
474 |
||
475 |
/** |
|
476 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
477 |
* division assignment {@code /=}. |
|
478 |
*/ |
|
479 |
DIVIDE_ASSIGNMENT(CompoundAssignmentTree.class), |
|
480 |
||
481 |
/** |
|
482 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
483 |
* remainder assignment {@code %=}. |
|
484 |
*/ |
|
485 |
REMAINDER_ASSIGNMENT(CompoundAssignmentTree.class), |
|
486 |
||
487 |
/** |
|
488 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
489 |
* addition or string concatenation assignment {@code +=}. |
|
490 |
*/ |
|
491 |
PLUS_ASSIGNMENT(CompoundAssignmentTree.class), |
|
492 |
||
493 |
/** |
|
494 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
495 |
* subtraction assignment {@code -=}. |
|
496 |
*/ |
|
497 |
MINUS_ASSIGNMENT(CompoundAssignmentTree.class), |
|
498 |
||
499 |
/** |
|
500 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
501 |
* left shift assignment {@code <<=}. |
|
502 |
*/ |
|
503 |
LEFT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
|
504 |
||
505 |
/** |
|
506 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
507 |
* right shift assignment {@code >>=}. |
|
508 |
*/ |
|
509 |
RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
|
510 |
||
511 |
/** |
|
512 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
513 |
* unsigned right shift assignment {@code >>>=}. |
|
514 |
*/ |
|
515 |
UNSIGNED_RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
|
516 |
||
517 |
/** |
|
518 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
519 |
* bitwise and logical "and" assignment {@code &=}. |
|
520 |
*/ |
|
521 |
AND_ASSIGNMENT(CompoundAssignmentTree.class), |
|
522 |
||
523 |
/** |
|
524 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
525 |
* bitwise and logical "xor" assignment {@code ^=}. |
|
526 |
*/ |
|
527 |
XOR_ASSIGNMENT(CompoundAssignmentTree.class), |
|
528 |
||
529 |
/** |
|
530 |
* Used for instances of {@link CompoundAssignmentTree} representing |
|
531 |
* bitwise and logical "or" assignment {@code |=}. |
|
532 |
*/ |
|
533 |
OR_ASSIGNMENT(CompoundAssignmentTree.class), |
|
534 |
||
535 |
/** |
|
39662
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
536 |
* Used for instances of {@link SpreadTree} representing |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
537 |
* spread "operator" for arrays and function call arguments. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
538 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
539 |
SPREAD(SpreadTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
540 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
541 |
/** |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
542 |
* Used for instances of {@link YieldTree} representing (generator) |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
543 |
* yield expression {@code yield expr}. |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
544 |
*/ |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
545 |
YIELD(YieldTree.class), |
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
546 |
|
e2b36a3779b9
8149929: Nashorn Parser API needs to be updated for ES6
sundar
parents:
35325
diff
changeset
|
547 |
/** |
29407 | 548 |
* Used for instances of {@link LiteralTree} representing |
549 |
* a number literal expression of type {@code double}. |
|
550 |
*/ |
|
551 |
NUMBER_LITERAL(LiteralTree.class), |
|
552 |
||
553 |
/** |
|
554 |
* Used for instances of {@link LiteralTree} representing |
|
555 |
* a boolean literal expression of type {@code boolean}. |
|
556 |
*/ |
|
557 |
BOOLEAN_LITERAL(LiteralTree.class), |
|
558 |
||
559 |
/** |
|
560 |
* Used for instances of {@link LiteralTree} representing |
|
561 |
* a string literal expression of type {@link String}. |
|
562 |
*/ |
|
563 |
STRING_LITERAL(LiteralTree.class), |
|
564 |
||
565 |
/** |
|
566 |
* Used for instances of {@link LiteralTree} representing |
|
567 |
* the use of {@code null}. |
|
568 |
*/ |
|
569 |
NULL_LITERAL(LiteralTree.class), |
|
570 |
||
571 |
/** |
|
572 |
* An implementation-reserved node. This is the not the node |
|
573 |
* you are looking for. |
|
574 |
*/ |
|
575 |
OTHER(null); |
|
576 |
||
41422 | 577 |
Kind(final Class<? extends Tree> intf) { |
29407 | 578 |
associatedInterface = intf; |
579 |
} |
|
580 |
||
29412
6dfd487fbad4
8074972: Unused imports, a missing javadoc and a build warning
sundar
parents:
29407
diff
changeset
|
581 |
/** |
6dfd487fbad4
8074972: Unused imports, a missing javadoc and a build warning
sundar
parents:
29407
diff
changeset
|
582 |
* Returns the associated interface type that uses this kind. |
6dfd487fbad4
8074972: Unused imports, a missing javadoc and a build warning
sundar
parents:
29407
diff
changeset
|
583 |
* @return the associated interface |
6dfd487fbad4
8074972: Unused imports, a missing javadoc and a build warning
sundar
parents:
29407
diff
changeset
|
584 |
*/ |
29407 | 585 |
public Class<? extends Tree> asInterface() { |
586 |
return associatedInterface; |
|
587 |
} |
|
588 |
||
589 |
/** |
|
590 |
* Returns if this is a literal tree kind or not. |
|
591 |
* |
|
592 |
* @return true if this is a literal tree kind, false otherwise |
|
593 |
*/ |
|
594 |
public boolean isLiteral() { |
|
595 |
return associatedInterface == LiteralTree.class; |
|
596 |
} |
|
597 |
||
598 |
/** |
|
599 |
* Returns if this is an expression tree kind or not. |
|
600 |
* |
|
601 |
* @return true if this is an expression tree kind, false otherwise |
|
602 |
*/ |
|
603 |
public boolean isExpression() { |
|
604 |
return ExpressionTree.class.isAssignableFrom(associatedInterface); |
|
605 |
} |
|
606 |
||
607 |
/** |
|
608 |
* Returns if this is a statement tree kind or not. |
|
609 |
* |
|
610 |
* @return true if this is a statement tree kind, false otherwise |
|
611 |
*/ |
|
612 |
public boolean isStatement() { |
|
613 |
return StatementTree.class.isAssignableFrom(associatedInterface); |
|
614 |
} |
|
615 |
||
616 |
private final Class<? extends Tree> associatedInterface; |
|
617 |
} |
|
618 |
||
619 |
/** |
|
620 |
* Start character offset of this Tree within the source. |
|
621 |
* |
|
622 |
* @return the position |
|
623 |
*/ |
|
624 |
long getStartPosition(); |
|
625 |
||
626 |
/** |
|
627 |
* End character offset of this Tree within the source. |
|
628 |
* |
|
629 |
* @return the position |
|
630 |
*/ |
|
631 |
long getEndPosition(); |
|
632 |
||
633 |
/** |
|
634 |
* Gets the kind of this tree. |
|
635 |
* |
|
636 |
* @return the kind of this tree. |
|
637 |
*/ |
|
638 |
Kind getKind(); |
|
639 |
||
640 |
/** |
|
641 |
* Accept method used to implement the visitor pattern. The |
|
642 |
* visitor pattern is used to implement operations on trees. |
|
643 |
* |
|
644 |
* @param <R> result type of this operation. |
|
645 |
* @param <D> type of additional data. |
|
646 |
* @param visitor tree visitor |
|
647 |
* @param data additional data passed to visitor methods |
|
648 |
* @return the value from visitor's visit methods |
|
649 |
*/ |
|
650 |
<R,D> R accept(TreeVisitor<R,D> visitor, D data); |
|
651 |
} |