summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMicro Dotta <mirco.dotta@gmail.com>2011-10-24 14:11:57 +0000
committerMicro Dotta <mirco.dotta@gmail.com>2011-10-24 14:11:57 +0000
commit6b70b7d23a23bca02f98a50d824d20db3bb3f8eb (patch)
tree02875e3f77d7a5e46ec8f82b1fbe08409de600f4 /src
parent70996f8583ba28de3dfe97bb3e7075cb56a4ea2f (diff)
downloadscala-6b70b7d23a23bca02f98a50d824d20db3bb3f8eb.tar.gz
scala-6b70b7d23a23bca02f98a50d824d20db3bb3f8eb.tar.bz2
scala-6b70b7d23a23bca02f98a50d824d20db3bb3f8eb.zip
Reverted r25886.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala70
1 files changed, 28 insertions, 42 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 1030643d39..ec364e237f 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -708,60 +708,46 @@ class Global(settings: Settings, reporter: Reporter, projectName: String = "")
/** Implements CompilerControl.askLinkPos */
private[interactive] def getLinkPos(sym: Symbol, source: SourceFile, response: Response[Position]) {
- def doGetLinkPos(sym: Symbol, source: SourceFile, response: Response[Position]) {
- informIDE("getLinkPos "+sym+" "+source)
- respond(response) {
- val preExisting = unitOfFile isDefinedAt source.file
- val originalTypeParams = sym.owner.typeParams
- reloadSources(List(source))
- parseAndEnter(getUnit(source).get)
- val owner = sym.owner
- if (owner.isClass) {
- val pre = adaptToNewRunMap(ThisType(owner))
- val newsym = pre.decl(sym.name) filter { alt =>
+ informIDE("getLinkPos "+sym+" "+source)
+ respond(response) {
+ val preExisting = unitOfFile isDefinedAt source.file
+ val originalTypeParams = sym.owner.typeParams
+ reloadSources(List(source))
+ parseAndEnter(getUnit(source).get)
+ val owner = sym.owner
+ if (owner.isClass) {
+ val pre = adaptToNewRunMap(ThisType(owner))
+ val newsym = pre.decl(sym.name) filter { alt =>
sym.isType || {
try {
val tp1 = pre.memberType(alt) onTypeError NoType
val tp2 = adaptToNewRunMap(sym.tpe) substSym (originalTypeParams, owner.typeParams)
matchesType(tp1, tp2, false)
} catch {
- case ex: Throwable =>
- println("error in hyperlinking: "+ex)
- ex.printStackTrace()
- false
+ case ex: Throwable =>
+ println("error in hyperlinking: "+ex)
+ ex.printStackTrace()
+ false
}
}
- }
- if (!preExisting) removeUnitOf(source)
- if (newsym == NoSymbol) {
- debugLog("link not found "+sym+" "+source+" "+pre)
- NoPosition
- } else if (newsym.isOverloaded) {
- settings.uniqid.value = true
- debugLog("link ambiguous "+sym+" "+source+" "+pre+" "+newsym.alternatives)
- NoPosition
- } else {
- debugLog("link found for "+newsym+": "+newsym.pos)
- newsym.pos
- }
- } else {
- debugLog("link not in class "+sym+" "+source+" "+owner)
+ }
+ if (!preExisting) removeUnitOf(source)
+ if (newsym == NoSymbol) {
+ debugLog("link not found "+sym+" "+source+" "+pre)
+ NoPosition
+ } else if (newsym.isOverloaded) {
+ settings.uniqid.value = true
+ debugLog("link ambiguous "+sym+" "+source+" "+pre+" "+newsym.alternatives)
NoPosition
+ } else {
+ debugLog("link found for "+newsym+": "+newsym.pos)
+ newsym.pos
}
+ } else {
+ debugLog("link not in class "+sym+" "+source+" "+owner)
+ NoPosition
}
}
-
- try {
- reload(List(source), new Response[Unit])
- doGetLinkPos(sym, source, response)
- }
- finally {
- /* Make sure to unload the `source` file that is supposed to contain
- * the definition of the symbol referenced by the link (i.e., `sym`).
- * The source is unloaded for performance reasons, as the more are the loaded
- * units, the slower is the background compiler. */
- removeUnitOf(source)
- }
}
def stabilizedType(tree: Tree): Type = tree match {