aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/node/ExplicitThisLiteralNode.java
blob: 0c1069843cde988ed2b4f138081ba2bd4bc76e5f (plain)
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
package org.checkerframework.dataflow.cfg.node;

import org.checkerframework.javacutil.InternalUtils;

import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.Tree;

/**
 * A node for a reference to 'this'.
 *
 * <pre>
 *   <em>this</em>
 * </pre>
 *
 * @author Stefan Heule
 * @author Charlie Garrett
 *
 */
public class ExplicitThisLiteralNode extends ThisLiteralNode {

    protected Tree tree;

    public ExplicitThisLiteralNode(Tree t) {
        super(InternalUtils.typeOf(t));
        assert t instanceof IdentifierTree
                && ((IdentifierTree) t).getName().contentEquals("this");
        tree = t;
    }

    @Override
    public Tree getTree() {
        return tree;
    }

    @Override
    public <R, P> R accept(NodeVisitor<R, P> visitor, P p) {
        return visitor.visitExplicitThisLiteral(this, p);
    }

    @Override
    public String toString() {
        return getName();
    }
}