summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-11-04 18:25:19 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-11-04 18:25:19 +0000
commita4895b85928399db4ed8d744ac3fc7208bee3a2f (patch)
treed35b8e593c23ca9532c2e90a87e04166132f5f40 /src/compiler/scala/tools/nsc/Global.scala
parentdbf0e12c15a0c0f3ac8833ecf70d0228ab0f1c3e (diff)
downloadscala-a4895b85928399db4ed8d744ac3fc7208bee3a2f.tar.gz
scala-a4895b85928399db4ed8d744ac3fc7208bee3a2f.tar.bz2
scala-a4895b85928399db4ed8d744ac3fc7208bee3a2f.zip
fix cyclic reference errors in scaladoc.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 8c8d0be322..191016e133 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -777,7 +777,8 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
/** Compile list of source files */
def compileSources(_sources: List[SourceFile]) {
- val sources = dependencyAnalysis.filter(_sources.removeDuplicates) // bug #1268, scalac confused by duplicated filenames
+ val depSources = dependencyAnalysis.filter(_sources.removeDuplicates) // bug #1268, scalac confused by duplicated filenames
+ val sources = pkgObjectsFirst(depSources)
if (reporter.hasErrors)
return // there is a problem already, e.g. a
// plugin was passed a bad option
@@ -921,6 +922,27 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
}
if (!pclazz.isRoot) resetPackageClass(pclazz.owner)
}
+
+ private def pkgObjectsFirst(files: List[SourceFile]) = {
+ def inScalaFolder(f: SourceFile) =
+ f.file.container.name == "scala"
+ val res = new ListBuffer[SourceFile]
+ var scalaObject: Option[SourceFile] = None
+ var lowPriorityImplicits: Option[SourceFile] = None
+ var predef: Option[SourceFile] = None
+ for (file <- files) file.file.name match {
+ case "ScalaObject.scala" if inScalaFolder(file) => scalaObject = Some(file)
+ case "LowPriorityImplicits.scala" if inScalaFolder(file) => lowPriorityImplicits = Some(file)
+ case "Predef.scala" if inScalaFolder(file) => predef = Some(file)
+ case "package.scala" => file +=: res // prepend package objects
+ case _ => res += file // append all others
+ }
+ val f: SourceFile => Unit = res.+=:(_)
+ predef map f // Predef 3rd
+ lowPriorityImplicits map f // LowPriorityImplicits 2nd
+ scalaObject map f // ScalaObject 1st
+ res.toList // then package objects, then others
+ }
} // class Run
def printAllUnits() {