summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-19 06:44:37 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-19 06:44:37 -0700
commitb63583036a57cffc1015b55deba3c9e64e345081 (patch)
treed4cca05405fd318d846edf7e1ba34e5481b81cda /src
parent9377625260699cd0d9f0aa2de2dce66edd0fca5a (diff)
parent4f3c92e0f8f8c8017a0363836324089f07d05c4c (diff)
downloadscala-b63583036a57cffc1015b55deba3c9e64e345081.tar.gz
scala-b63583036a57cffc1015b55deba3c9e64e345081.tar.bz2
scala-b63583036a57cffc1015b55deba3c9e64e345081.zip
Merge pull request #943 from adriaanm/rebase-ticket-5939
SI-5939 resident compilation of sources in empty package
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala21
-rw-r--r--src/reflect/scala/reflect/internal/Mirrors.scala3
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala5
3 files changed, 12 insertions, 17 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 0c988ceae4..9b4e793241 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -34,8 +34,7 @@ abstract class SymbolLoaders {
/** Enter class with given `name` into scope of `root`
* and give them `completer` as type.
*/
- def enterClass(root: Symbol, name: String, completer: SymbolLoader): Symbol = {
- val owner = root.ownerOfNewSymbols
+ def enterClass(owner: Symbol, name: String, completer: SymbolLoader): Symbol = {
val clazz = owner.newClass(newTypeName(name))
clazz setInfo completer
enterIfNew(owner, clazz, completer)
@@ -44,8 +43,7 @@ abstract class SymbolLoaders {
/** Enter module with given `name` into scope of `root`
* and give them `completer` as type.
*/
- def enterModule(root: Symbol, name: String, completer: SymbolLoader): Symbol = {
- val owner = root.ownerOfNewSymbols
+ def enterModule(owner: Symbol, name: String, completer: SymbolLoader): Symbol = {
val module = owner.newModule(newTermName(name))
module setInfo completer
module.moduleClass setInfo moduleClassLoader
@@ -217,15 +215,18 @@ abstract class SymbolLoaders {
root.setInfo(new PackageClassInfoType(newScope, root))
val sourcepaths = classpath.sourcepaths
- for (classRep <- classpath.classes if platform.doLoad(classRep)) {
- initializeFromClassPath(root, classRep)
+ if (!root.isRoot) {
+ for (classRep <- classpath.classes if platform.doLoad(classRep)) {
+ initializeFromClassPath(root, classRep)
+ }
}
+ if (!root.isEmptyPackageClass) {
+ for (pkg <- classpath.packages) {
+ enterPackage(root, pkg.name, new PackageLoader(pkg))
+ }
- for (pkg <- classpath.packages) {
- enterPackage(root, pkg.name, new PackageLoader(pkg))
+ openPackageModule(root)
}
-
- openPackageModule(root)
}
}
diff --git a/src/reflect/scala/reflect/internal/Mirrors.scala b/src/reflect/scala/reflect/internal/Mirrors.scala
index 210af661ee..761b993539 100644
--- a/src/reflect/scala/reflect/internal/Mirrors.scala
+++ b/src/reflect/scala/reflect/internal/Mirrors.scala
@@ -180,7 +180,7 @@ trait Mirrors extends api.Mirrors {
// Still fiddling with whether it's cleaner to do some of this setup here
// or from constructors. The latter approach tends to invite init order issues.
- EmptyPackageClass setInfo ClassInfoType(Nil, newPackageScope(EmptyPackageClass), EmptyPackageClass)
+ EmptyPackageClass setInfo rootLoader
EmptyPackage setInfo EmptyPackageClass.tpe
connectModuleToClass(EmptyPackage, EmptyPackageClass)
@@ -231,7 +231,6 @@ trait Mirrors extends api.Mirrors {
override def isEffectiveRoot = true
override def isStatic = true
override def isNestedClass = false
- override def ownerOfNewSymbols = EmptyPackageClass
}
// The empty package, which holds all top level types without given packages.
final object EmptyPackage extends ModuleSymbol(RootClass, NoPosition, nme.EMPTY_PACKAGE_NAME) with WellKnownSymbol {
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index fab5c5a2e7..d484617767 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -813,11 +813,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
*/
def isEffectiveRoot = false
- /** For RootClass, this is EmptyPackageClass. For all other symbols,
- * the symbol itself.
- */
- def ownerOfNewSymbols = this
-
final def isLazyAccessor = isLazy && lazyAccessor != NoSymbol
final def isOverridableMember = !(isClass || isEffectivelyFinal) && (this ne NoSymbol) && owner.isClass