summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interactive/Global.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-01-20 16:19:40 +0000
committerMartin Odersky <odersky@gmail.com>2011-01-20 16:19:40 +0000
commit161a4fda3967b3b496d6afc98e285d4f5220998c (patch)
tree293279f33ffde8fa48c03837e75e6d757f0e1fe2 /src/compiler/scala/tools/nsc/interactive/Global.scala
parent7a9f1437ab88403d8a9611c0790d583996db96c3 (diff)
downloadscala-161a4fda3967b3b496d6afc98e285d4f5220998c.tar.gz
scala-161a4fda3967b3b496d6afc98e285d4f5220998c.tar.bz2
scala-161a4fda3967b3b496d6afc98e285d4f5220998c.zip
Added askLinkPos command for hyperlinking.
Fixed a problem noted by Iulian in completion. Review by vigdorchik
Diffstat (limited to 'src/compiler/scala/tools/nsc/interactive/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 0787142c9a..6efe96861e 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -170,6 +170,7 @@ self =>
var moreWorkAtNode: Int = -1
var nodesSeen = 0
+ var noWorkFoundAtNode: Int = -1
/** Called from runner thread and signalDone:
* Poll for interrupts and execute them immediately.
@@ -226,7 +227,10 @@ self =>
debugLog("quitting work item: "+action)
}
case None =>
- debugLog("no work found")
+ if (nodesSeen > noWorkFoundAtNode) {
+ debugLog("no work found")
+ noWorkFoundAtNode = nodesSeen
+ }
}
}
}
@@ -480,6 +484,32 @@ self =>
}
}
+ def getLinkPos(sym: Symbol, source: SourceFile, response: Response[Position]) {
+ informIDE("getLinkPos "+sym+" "+source)
+ respond(response) {
+ reloadSources(List(source))
+ val owner = sym.owner
+ if (owner.isClass) {
+ val pre = adaptToNewRunMap(ThisType(owner))
+ val newsym = pre.decl(sym.name) filter { alt =>
+ sym.isType || matchesType(pre.memberType(alt), pre.memberType(sym), false)
+ }
+ if (newsym == NoSymbol) {
+ debugLog("link not found "+sym+" "+source+" "+pre)
+ NoPosition
+ } else if (newsym.isOverloaded) {
+ 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
+ }
+ }
+
def stabilizedType(tree: Tree): Type = tree match {
case Ident(_) if tree.symbol.isStable =>
singleType(NoPrefix, tree.symbol)