mirror of https://github.com/sbt/sbt.git
sync resident compiler code
This commit is contained in:
parent
8908d0e93b
commit
0de4444665
|
|
@ -264,12 +264,12 @@ private final class CachedCompiler0(args: Array[String], initialLog: WeakLog, re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private def reSyncCompat(root: ClassSymbol, allEntry: OptClassPath, oldEntry: OptClassPath, newEntry: OptClassPath)
|
private def reSyncCompat(root: ClassSymbol, allEntries: OptClassPath, oldEntry: OptClassPath, newEntry: OptClassPath)
|
||||||
{
|
{
|
||||||
val getName: PlatformClassPath => String = (_.name)
|
val getName: PlatformClassPath => String = (_.name)
|
||||||
def hasClasses(cp: OptClassPath) = cp.exists(_.classes.nonEmpty)
|
def hasClasses(cp: OptClassPath) = cp.exists(_.classes.nonEmpty)
|
||||||
def invalidateOrRemove(root: ClassSymbol) =
|
def invalidateOrRemove(root: ClassSymbol) =
|
||||||
allEntry match {
|
allEntries match {
|
||||||
case Some(cp) => root setInfo newPackageLoader0[Type](cp)
|
case Some(cp) => root setInfo newPackageLoader0[Type](cp)
|
||||||
case None => root.owner.info.decls unlink root.sourceModule
|
case None => root.owner.info.decls unlink root.sourceModule
|
||||||
}
|
}
|
||||||
|
|
@ -283,7 +283,7 @@ private final class CachedCompiler0(args: Array[String], initialLog: WeakLog, re
|
||||||
invalidateOrRemove(root)
|
invalidateOrRemove(root)
|
||||||
} else {
|
} else {
|
||||||
if (classesFound && root.isRoot)
|
if (classesFound && root.isRoot)
|
||||||
invalidateOrRemove(definitions.EmptyPackageClass.asInstanceOf[ClassSymbol])
|
invalidateOrRemove(definitions.EmptyPackageClass.asInstanceOf[ClassSymbol])
|
||||||
(oldEntry, newEntry) match {
|
(oldEntry, newEntry) match {
|
||||||
case (Some(oldcp) , Some(newcp)) =>
|
case (Some(oldcp) , Some(newcp)) =>
|
||||||
for (pstr <- packageNames(oldcp) ++ packageNames(newcp)) {
|
for (pstr <- packageNames(oldcp) ++ packageNames(newcp)) {
|
||||||
|
|
@ -292,13 +292,11 @@ private final class CachedCompiler0(args: Array[String], initialLog: WeakLog, re
|
||||||
if (pkg == NoSymbol) {
|
if (pkg == NoSymbol) {
|
||||||
// package was created by external agent, create symbol to track it
|
// package was created by external agent, create symbol to track it
|
||||||
assert(!subPackage(oldcp, pstr).isDefined)
|
assert(!subPackage(oldcp, pstr).isDefined)
|
||||||
pkg = root.newPackage(NoPosition, pname)
|
pkg = enterPackageCompat(root, pname, newPackageLoader0[loaders.SymbolLoader](allEntries.get))
|
||||||
pkg.setInfo(pkg.moduleClass.tpe)
|
|
||||||
root.info.decls.enter(pkg)
|
|
||||||
}
|
}
|
||||||
reSyncCompat(
|
reSyncCompat(
|
||||||
pkg.moduleClass.asInstanceOf[ClassSymbol],
|
pkg.moduleClass.asInstanceOf[ClassSymbol],
|
||||||
subPackage(allEntry.get, pstr), subPackage(oldcp, pstr), subPackage(newcp, pstr))
|
subPackage(allEntries.get, pstr), subPackage(oldcp, pstr), subPackage(newcp, pstr))
|
||||||
}
|
}
|
||||||
case (Some(oldcp), None) => invalidateOrRemove(root)
|
case (Some(oldcp), None) => invalidateOrRemove(root)
|
||||||
case (None, Some(newcp)) => invalidateOrRemove(root)
|
case (None, Some(newcp)) => invalidateOrRemove(root)
|
||||||
|
|
@ -306,6 +304,14 @@ private final class CachedCompiler0(args: Array[String], initialLog: WeakLog, re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private[this] def enterPackageCompat(root: ClassSymbol, pname: Name, completer: loaders.SymbolLoader): Symbol =
|
||||||
|
{
|
||||||
|
val pkg = root.newPackage(pname)
|
||||||
|
pkg.moduleClass.setInfo(completer)
|
||||||
|
pkg.setInfo(pkg.moduleClass.tpe)
|
||||||
|
root.info.decls.enter(pkg)
|
||||||
|
pkg
|
||||||
|
}
|
||||||
|
|
||||||
// type parameter T, `dummy` value for inference, and reflection are source compatibility hacks
|
// type parameter T, `dummy` value for inference, and reflection are source compatibility hacks
|
||||||
// to work around JavaPackageLoader and PackageLoader changes between 2.9 and 2.10
|
// to work around JavaPackageLoader and PackageLoader changes between 2.9 and 2.10
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue