diff options
Diffstat (limited to 'sources/scalac/checkers/CheckNames.java')
-rw-r--r-- | sources/scalac/checkers/CheckNames.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sources/scalac/checkers/CheckNames.java b/sources/scalac/checkers/CheckNames.java new file mode 100644 index 0000000000..a129aa0236 --- /dev/null +++ b/sources/scalac/checkers/CheckNames.java @@ -0,0 +1,47 @@ +/* ____ ____ ____ ____ ______ *\ +** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala ** +** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL ** +** /_____/\____/\___/\____/____/ ** +\* */ + +// $Id$ + +package scalac.checkers; + +import scalac.ast.Tree; +import scalac.util.Name; +import scalac.util.Debug; +import scalac.symtab.Symbol; + +/** + * Check that the of symbols are of the appropriate kind + * + * @author Nikolay Mihaylov + * @version 1.0 + */ + +public class CheckNames extends Checker { + + public CheckNames(scalac.Global global) { + super(global); + } + + public void check(Tree tree) { + switch (tree) { + case ClassDef(_, Name name, _, _, _, _): + verify(tree, + name.isTypeName(), + "name kinds", + "class " + Debug.show(tree.symbol()) + + "should have a type name"); + + Symbol constr = tree.symbol().constructor(); + verify(tree, + constr.name.isConstrName(), + "name kinds", + "the class constructor " + Debug.show(constr) + + " should have a constructor name"); + break; + } + } +} |