summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-21 17:59:47 +0000
committerPaul Phillips <paulp@improving.org>2010-10-21 17:59:47 +0000
commit006fbc37ca3c3b47090c937d7cc5a1c49d005f09 (patch)
tree3f9d76fde5e803727865401c3483416ed9c80b80
parentcfb50cbccefea3ce00e7a78913993c4602ab9e77 (diff)
downloadscala-006fbc37ca3c3b47090c937d7cc5a1c49d005f09.tar.gz
scala-006fbc37ca3c3b47090c937d7cc5a1c49d005f09.tar.bz2
scala-006fbc37ca3c3b47090c937d7cc5a1c49d005f09.zip
A couple minor cleanups in Global. No review.
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala26
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala3
2 files changed, 13 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index d3f505d0e2..288817ec1c 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -93,13 +93,11 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
val global: Global.this.type = Global.this
} with CopyPropagation
- /** Some statistics (normally disabled) */
+ /** Some statistics (normally disabled) set with -Ystatistics */
object statistics extends {
val global: Global.this.type = Global.this
} with Statistics
- util.Statistics.enabled = settings.Ystatistics.value
-
/** Computing pairs of overriding/overridden symbols */
object overridingPairs extends {
val global: Global.this.type = Global.this
@@ -912,7 +910,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
*
* 1 is to avoid cyclic reference errors.
* 2 is due to the following. When completing "Predef" (*), typedIdent is called
- * for its parents (e.g. "LowPriorityImplicits"). typedIdent checks wethter
+ * for its parents (e.g. "LowPriorityImplicits"). typedIdent checks whether
* the symbol reallyExists, which tests if the type of the symbol after running
* its completer is != NoType.
* If the "namer" phase has not yet run for "LowPriorityImplicits", the symbol
@@ -930,18 +928,16 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
*
*/
private def coreClassesFirst(files: List[SourceFile]) = {
- def inScalaFolder(f: SourceFile) =
- f.file.container.name == "scala"
- var scalaObject: Option[SourceFile] = None
- val res = new ListBuffer[SourceFile]
- for (file <- files) file.file.name match {
- case "ScalaObject.scala" if inScalaFolder(file) => scalaObject = Some(file)
- case "LowPriorityImplicits.scala" if inScalaFolder(file) => file +=: res
- case "StandardEmbeddings.scala" if inScalaFolder(file) => file +=: res
- case _ => res += file
+ def rank(f: SourceFile) = {
+ if (f.file.container.name != "scala") 3
+ else f.file.name match {
+ case "ScalaObject.scala" => 1
+ case "LowPriorityImplicits.scala" => 2
+ case "StandardEmbeddings.scala" => 2
+ case _ => 3
+ }
}
- for (so <- scalaObject) so +=: res
- res.toList
+ files sortBy rank
}
} // class Run
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 856c5fdb59..71b4f6d7bd 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -128,7 +128,8 @@ trait ScalaSettings extends AbsScalaSettings with StandardScalaSettings {
val skip = PhasesSetting ("-Yskip", "Skip")
val Xsqueeze = ChoiceSetting ("-Ysqueeze", "if on, creates compact code in matching", List("on","off"), "on") .
withHelpSyntax("-Ysqueeze:<enabled>")
- val Ystatistics = BooleanSetting ("-Ystatistics", "Print compiler statistics")
+ val Ystatistics = BooleanSetting ("-Ystatistics", "Print compiler statistics") .
+ withPostSetHook(_ => util.Statistics.enabled = true)
val stop = PhasesSetting ("-Ystop", "Stop after phase")
val refinementMethodDispatch =
ChoiceSetting ("-Ystruct-dispatch", "Selects dispatch method for structural refinement method calls",