summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Vigdorchik <eugenevigdorchik@epfl.ch>2010-12-07 08:59:24 +0000
committerEugene Vigdorchik <eugenevigdorchik@epfl.ch>2010-12-07 08:59:24 +0000
commitef89729e20aee4f5397792425e344339fe1e7094 (patch)
treeecc1696ee1c96fae3cde9d2fcbbe453d506b8e76
parent0f2a7867cfb34cfb3dcf508fd8e167d7d71e25fb (diff)
downloadscala-ef89729e20aee4f5397792425e344339fe1e7094.tar.gz
scala-ef89729e20aee4f5397792425e344339fe1e7094.tar.bz2
scala-ef89729e20aee4f5397792425e344339fe1e7094.zip
Parse the contents of the package right away in...
Parse the contents of the package right away in the presentation compiler. No review.
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala1
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala1
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala22
3 files changed, 14 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 0f8e039323..d1091a4b7c 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -1124,6 +1124,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
def forJVM = opt.jvm
def forMSIL = opt.msil
+ def forInteractive = false
def onlyPresentation = false
def createJavadoc = false
}
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index da6051acae..f44093dc5e 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -32,6 +32,7 @@ self =>
if (debugIDE) println(msg)
override def onlyPresentation = true
+ override def forInteractive = true
/** A list indicating in which order some units should be typechecked.
* All units in firsts are typechecked before any unit not in this list
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 77428f127d..f71d085333 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -147,16 +147,18 @@ abstract class SymbolLoaders {
val sourcepaths = classpath.sourcepaths
for (classRep <- classpath.classes if doLoad(classRep)) {
- if (classRep.binary.isDefined && classRep.source.isDefined) {
- val (bin, src) = (classRep.binary.get, classRep.source.get)
- val loader = if (needCompile(bin, src)) new SourcefileLoader(src)
- else newClassLoader(bin)
- enterClassAndModule(root, classRep.name, loader)
- } else if (classRep.binary.isDefined) {
- enterClassAndModule(root, classRep.name, newClassLoader(classRep.binary.get))
- } else if (classRep.source.isDefined) {
- enterClassAndModule(root, classRep.name, new SourcefileLoader(classRep.source.get))
- }
+ def enterToplevels(src: AbstractFile) {
+ if (global.forInteractive)
+ // Parse the source right away in the presentation compiler.
+ global.currentRun.compileLate(src)
+ else
+ enterClassAndModule(root, classRep.name, new SourcefileLoader(src))
+ }
+ ((classRep.binary, classRep.source) : @unchecked) match {
+ case (Some(bin), Some(src)) if needCompile(bin, src) => enterToplevels(src)
+ case (None, Some(src)) => enterToplevels(src)
+ case (Some(bin), _) => enterClassAndModule(root, classRep.name, newClassLoader(bin))
+ }
}
for (pkg <- classpath.packages) {