summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-01-28 18:14:42 +0000
committerMartin Odersky <odersky@gmail.com>2011-01-28 18:14:42 +0000
commit0967826371df4675053b94a2857a6d78dd9028ea (patch)
tree63ef0d7552daa068d7aafdeb2b67539616e27f86
parent43d3c0218579e454826e453d03d17df67b75dc61 (diff)
downloadscala-0967826371df4675053b94a2857a6d78dd9028ea.tar.gz
scala-0967826371df4675053b94a2857a6d78dd9028ea.tar.bz2
scala-0967826371df4675053b94a2857a6d78dd9028ea.zip
Eliminated askLastTypeTree.
-rw-r--r--src/compiler/scala/tools/nsc/interactive/CompilerControl.scala5
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala25
2 files changed, 11 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
index de2e6206d6..376ab7936c 100644
--- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
@@ -193,12 +193,13 @@ trait CompilerControl { self: Global =>
/** Tells the compile server to shutdown, and not to restart again */
def askShutdown() = scheduler raise ShutdownReq
- /** Returns parse tree for source `source`. No symbols are entered. Syntax errors are reported.
- */
+ @deprecated("use parseTree(source) instead")
def askParse(source: SourceFile, response: Response[Tree]) = respond(response) {
parseTree(source)
}
+ /** Returns parse tree for source `source`. No symbols are entered. Syntax errors are reported.
+ */
def parseTree(source: SourceFile): Tree = ask { () =>
getUnit(source) match {
case Some(unit) if unit.status >= JustParsed =>
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 700b2393fe..644d5712ce 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -328,7 +328,7 @@ self =>
for (s <- allSources; unit <- getUnit(s)) {
if (!unit.isUpToDate && unit.status != JustParsed) reset(unit) // reparse previously typechecked units.
- if (unit.status == NotLoaded) parse(unit)
+ if (unit.status == NotLoaded) parseAndEnter(unit)
}
for (s <- allSources; unit <- getUnit(s)) {
@@ -364,7 +364,7 @@ self =>
}
/** Parse unit and create a name index. */
- def parse(unit: RichCompilationUnit): Unit = {
+ def parseAndEnter(unit: RichCompilationUnit): Unit = {
debugLog("parsing: "+unit)
currentTyperRun.compileLate(unit)
if (debugIDE && !reporter.hasErrors) validatePositions(unit.body)
@@ -372,11 +372,14 @@ self =>
unit.status = JustParsed
}
+ @deprecated("use parseTree(unit.source) instead")
+ def parse(unit: RichCompilationUnit) = parseAndEnter(unit)
+
/** Make sure unit is typechecked
*/
def typeCheck(unit: RichCompilationUnit) {
debugLog("type checking: "+unit)
- if (unit.status == NotLoaded) parse(unit)
+ if (unit.status == NotLoaded) parseAndEnter(unit)
unit.status = PartiallyChecked
currentTyperRun.typeCheck(unit)
unit.lastBody = unit.body
@@ -447,7 +450,7 @@ self =>
val unit = new RichCompilationUnit(source)
unitOfFile(source.file) = unit
reset(unit)
- parse(unit)
+ parseAndEnter(unit)
}
/** Make sure a set of compilation units is loaded and parsed */
@@ -518,18 +521,6 @@ self =>
respond(response)(typedTree(source, forceReload))
}
- /** Set sync var `response` to the last fully attributed tree produced from the
- * entire compilation unit */
- def getLastTypedTree(source: SourceFile, response: Response[Tree]) {
- informIDE("getLastTyped" + source)
- respond(response) {
- val unit = getOrCreateUnitOf(source)
- if (unit.status > PartiallyChecked) unit.body
- else if (unit.lastBody ne EmptyTree) unit.lastBody
- else typedTree(source, false)
- }
- }
-
/** Implements CompilerControl.askLinkPos */
def getLinkPos(sym: Symbol, source: SourceFile, response: Response[Position]) {
informIDE("getLinkPos "+sym+" "+source)
@@ -759,7 +750,7 @@ self =>
}
respond(response) {
onUnitOf(source) { unit =>
- if (unit.status == NotLoaded) parse(unit)
+ if (unit.status == NotLoaded) parseAndEnter(unit)
structureTraverser.traverse(unit.body)
val topLevelSyms = structureTraverser.getResult
topLevelSyms foreach forceSym