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

// $Id$

package scalac.checkers;

import scalac.ast.Tree;
import scalac.symtab.Symbol;
import scalac.Global;

/**
 * Verify that all tree nodes for which hasSymbol() is true have a
 * non-null symbol.
 *
 * @author Michel Schinz
 * @version 1.0
 */

public class CheckSymbols extends Checker {
    public CheckSymbols(Global global) { super(global); }

    public void check(Tree tree) {
        verify(tree,
               implies(tree.hasSymbol(), tree.symbol() != null),
               "symbol not null",
               "hasSymbol => symbol not null");
        verify(tree,
               implies(tree.hasSymbol(), tree.symbol() != Symbol.NONE),
               "symbol not NONE",
               "hasSymbol => symbol not NONE");
    }
}