|
1 |
| package koala.dynamicjava.interpreter; |
|
2 |
| |
|
3 |
| import koala.dynamicjava.tree.Node; |
|
4 |
| import koala.dynamicjava.tree.Expression; |
|
5 |
| import koala.dynamicjava.tree.SourceInfo; |
|
6 |
| import koala.dynamicjava.tree.TypeName; |
|
7 |
| import koala.dynamicjava.tree.visitor.Visitor; |
|
8 |
| |
|
9 |
| public class TypeUtil { |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
417
| public static Expression makeEmptyExpression() {
|
|
19 |
417
| return new Expression(SourceInfo.NONE) {
|
|
20 |
0
| public <T> T acceptVisitor(Visitor<T> v) {
|
|
21 |
0
| throw new IllegalArgumentException("Cannot visit an empty expression");
|
|
22 |
| } |
|
23 |
| }; |
|
24 |
| } |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
79
| public static Expression makeEmptyExpression(Node location) {
|
|
33 |
79
| return new Expression(location.getSourceInfo()) {
|
|
34 |
0
| public <T> T acceptVisitor(Visitor<T> v) {
|
|
35 |
0
| throw new IllegalArgumentException("Cannot visit an empty expression");
|
|
36 |
| } |
|
37 |
| }; |
|
38 |
| } |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
20
| public static TypeName makeEmptyTypeName() {
|
|
45 |
20
| return new TypeName(SourceInfo.NONE) {
|
|
46 |
0
| public <T> T acceptVisitor(Visitor<T> v) {
|
|
47 |
0
| throw new IllegalArgumentException("Cannot visit an empty type name");
|
|
48 |
| } |
|
49 |
| }; |
|
50 |
| } |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
0
| public static TypeName makeEmptyTypeName(Node location) {
|
|
58 |
0
| return new TypeName(location.getSourceInfo()) {
|
|
59 |
0
| public <T> T acceptVisitor(Visitor<T> v) {
|
|
60 |
0
| throw new IllegalArgumentException("Cannot visit an empty type name");
|
|
61 |
| } |
|
62 |
| }; |
|
63 |
| } |
|
64 |
| |
|
65 |
| } |