summaryrefslogtreecommitdiff
path: root/sources/meta/scalac/ast/TreeFieldLink.java
blob: b338ccd6eb76eb110895b237e1b0528b5abd9fbd (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
/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
\*                                                                      */

// $Id$

package meta.scalac.ast;

/**
 * This class describes the possible links between a given field of a
 * tree and the symbol of that tree.
 */
public class TreeFieldLink {

    //########################################################################
    // Public Cases

    /** Field is linked to the symbol's flags */
    public case SymFlags;

    /** Field is linked to the symbol's name */
    public case SymName;

    //########################################################################
    // Public Methods

    /** Returns the field or method to invoke to get the linked value. */
    public String getLink() {
        switch (this) {
        case SymFlags:
            return "flags";
        case SymName:
            return "name";
        default:
            throw new Error("unknown case: " + this);
        }
    }

    /** Returns the name of this link. */
    public String toString() {
        switch (this) {
        case SymFlags:
            return "flags";
        case SymName:
            return "name";
        default:
            throw new Error("unknown case: " + this);
        }
    }

    //########################################################################
}