summaryrefslogtreecommitdiff
path: root/sources/scalac
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2003-02-27 11:48:48 +0000
committermihaylov <mihaylov@epfl.ch>2003-02-27 11:48:48 +0000
commit647a30b9bfb11b9c069b5349050083be57e7e92d (patch)
tree3605a1de8215a090990f8da34e2bd9e771f65469 /sources/scalac
parent9454221e70396c0f93c6295026e664a1df2905c9 (diff)
downloadscala-647a30b9bfb11b9c069b5349050083be57e7e92d.tar.gz
scala-647a30b9bfb11b9c069b5349050083be57e7e92d.tar.bz2
scala-647a30b9bfb11b9c069b5349050083be57e7e92d.zip
Initial import of the CheckNames class.
Diffstat (limited to 'sources/scalac')
-rw-r--r--sources/scalac/checkers/CheckNames.java47
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;
+ }
+ }
+}