blob: 419fed14bb0a2a4390ffe781eb9061f8c8e67603 (
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
|
package scala.reflect
package runtime
/**
* This symbol table trait fills in the definitions so that class information is obtained by refection.
* It can be used either from the reflexive mirror itself (class Universe), or else from
* a runtime compiler that uses reflection to get a class information (class scala.tools.nsc.ReflectGlobal)
*/
trait SymbolTable extends internal.SymbolTable with JavaToScala with ScalaToJava with Loaders {
/** If `owner` is a package class and `name` is a term name, make a new package
* <owner>.<name>, otherwise return NoSymbol
*/
override def missingHook(owner: Symbol, name: Name): Symbol =
if (name.isTermName && owner.hasPackageFlag)
makeScalaPackage(if (owner.isRoot) name.toString else owner.fullName+"."+name).sourceModule
else {
info("*** missing: "+name+"/"+name.isTermName+"/"+owner+"/"+owner.hasPackageFlag+"/"+owner.info.decls.getClass)
super.missingHook(owner, name)
}
/** Assert that packages have package scopes */
override def validateClassInfo(tp: ClassInfoType) {
assert(!tp.typeSymbol.isPackageClass || tp.decls.isInstanceOf[PackageScope])
}
protected var verbose = false
def info(msg: => String) =
if (verbose) println("[reflect-compiler] "+msg)
}
|