diff options
author | Martin Odersky <odersky@gmail.com> | 2011-02-14 09:36:59 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-02-14 09:36:59 +0000 |
commit | ba5118b24c921d1616288affbd05e376ad790f7a (patch) | |
tree | 85ffa813a5461f4a1e575ac8724fedec78693fb8 /src | |
parent | 6201a2c638e05d53f949d86314d4b77e3db606b8 (diff) | |
download | scala-ba5118b24c921d1616288affbd05e376ad790f7a.tar.gz scala-ba5118b24c921d1616288affbd05e376ad790f7a.tar.bz2 scala-ba5118b24c921d1616288affbd05e376ad790f7a.zip |
solved hyperlinking problems caused by making p...
solved hyperlinking problems caused by making parsing lazy.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Global.scala | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index cef6ba5dbd..ef29bfcee3 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -348,7 +348,7 @@ self => for (s <- allSources; unit <- getUnit(s)) { pollForWork(NoPosition) if (!unit.isUpToDate && unit.status != JustParsed) reset(unit) // reparse previously typechecked units. - if (unit.status == NotLoaded) parseAndEnter(unit) + parseAndEnter(unit) } /** Sleep window */ @@ -393,23 +393,21 @@ self => unit.status = NotLoaded } - /** Parse unit and create a name index. */ - protected def parseAndEnter(unit: RichCompilationUnit): Unit = { - debugLog("parsing: "+unit) - currentTyperRun.compileLate(unit) - if (debugIDE && !reporter.hasErrors) validatePositions(unit.body) - if (!unit.isJava) syncTopLevelSyms(unit) - unit.status = JustParsed - } - - @deprecated("use parseTree(unit.source) instead") - private def parse(unit: RichCompilationUnit) = parseAndEnter(unit) + /** Parse unit and create a name index, unless this has already been done before */ + protected def parseAndEnter(unit: RichCompilationUnit): Unit = + if (unit.status == NotLoaded) { + debugLog("parsing: "+unit) + currentTyperRun.compileLate(unit) + if (debugIDE && !reporter.hasErrors) validatePositions(unit.body) + if (!unit.isJava) syncTopLevelSyms(unit) + unit.status = JustParsed + } /** Make sure unit is typechecked */ protected def typeCheck(unit: RichCompilationUnit) { debugLog("type checking: "+unit) - if (unit.status == NotLoaded) parseAndEnter(unit) + parseAndEnter(unit) unit.status = PartiallyChecked currentTyperRun.typeCheck(unit) unit.lastBody = unit.body @@ -509,7 +507,7 @@ self => result case Some(unit) => informIDE("typedTreeAt " + pos) - if (unit.status == NotLoaded) parseAndEnter(unit) + parseAndEnter(unit) val tree = locateTree(pos) debugLog("at pos "+pos+" was found: "+tree.getClass+" "+tree.pos.show) if (stabilizedType(tree) ne null) { @@ -535,7 +533,7 @@ self => informIDE("typedTree " + source + " forceReload: " + forceReload) val unit = getOrCreateUnitOf(source) if (forceReload) reset(unit) - if (unit.status == NotLoaded) parseAndEnter(unit) + parseAndEnter(unit) if (unit.status <= PartiallyChecked) { //newTyperRun() // not deeded for idempotent type checker phase typeCheck(unit) @@ -560,6 +558,7 @@ self => respond(response) { val preExisting = unitOfFile isDefinedAt source.file reloadSources(List(source)) + parseAndEnter(getUnit(source).get) val owner = sym.owner if (owner.isClass) { val pre = adaptToNewRunMap(ThisType(owner)) @@ -796,7 +795,7 @@ self => protected def getParsedEnteredNow(source: SourceFile, response: Response[Tree]) { respond(response) { onUnitOf(source) { unit => - if (unit.status == NotLoaded) parseAndEnter(unit) + parseAndEnter(unit) unit.body } } |