blob: 35dcd0dd55c94ab7464fb86a5ce97c3940399a42 (
plain) (
blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/* ____ ____ ____ ____ ______ *\
** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
** /_____/\____/\___/\____/____/ **
\* */
// $Id$
package meta.scalac.ast;
/** This class enumerates the different kinds of tree nodes. */
public class TreeKind {
//########################################################################
// Public Cases
/** Designates a type, a term or anything else. */
public case Any;
/** Designates a type. */
public case Type;
/** Designates a term. */
public case Term;
/** Designates either a type or a term. */
public case Dual;
/** Designates either a type or a term (a test may indicate which one). */
public case Test;
/** Designates neither a type nor a term. */
public case None;
//########################################################################
// Public Method
public boolean isA(TreeKind that) {
switch (this) {
case Any : return true;
case Type: return that == Type;
case Term: return that == Term;
case Dual: return that == Type || that == Term || that == Dual;
case Test: return that == Type || that == Term || that == Dual;
case None: return that == None;
default : throw new Error();
}
}
public String toString() {
switch(this) {
case Any : return "Any";
case Type: return "Type";
case Term: return "Term";
case Dual: return "Dual";
case Test: return "Test";
case None: return "None";
default : throw new Error();
}
}
//########################################################################
}
|