blob: 14be8e9317667fc236fba1fb45dafca75f4340fd (
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
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2002-2004, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
** $Id$
\* */
package scala.reflect;
abstract class Symbol {
val owner: Symbol;
val name: String;
val tpe: Type;
}
abstract class GlobalSymbol(val fullname: String) extends Symbol {
private val pointIndex = fullname.lastIndexOf('.');
val owner: Symbol =
if (pointIndex < 0) RootSymbol else Class(fullname.substring(0, pointIndex));
val name: String =
if (pointIndex < 0) fullname else fullname.substring(pointIndex, fullname.length());
}
abstract class LocalSymbol extends Symbol {}
case class Class(override val fullname: String) extends GlobalSymbol(fullname) {
val tpe = NamedType(fullname);
}
case class Method(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
case class Field(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
case class TypeField(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
case class LocalValue(owner: Symbol, name: String, tpe: Type) extends LocalSymbol;
case class LocalMethod(owner: Symbol, name: String, tpe: Type) extends LocalSymbol;
case object NoSymbol extends Symbol {
val owner = null;
val name = null;
val tpe = NoType
}
case object RootSymbol extends Symbol {
val owner = NoSymbol;
val name = "<root>";
val tpe = NoPrefix
}
|