summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-07-19 15:55:31 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-07-19 15:55:31 +0000
commitcc57d03af8a97c4b9a6162acbc3a727384bb8a86 (patch)
treebc921cf51ebc927eaf96f843fd65890eadd1e33e /src
parent5bef3feb67077264ce6f5abbf8fd235f5afe6a5d (diff)
downloadscala-cc57d03af8a97c4b9a6162acbc3a727384bb8a86.tar.gz
scala-cc57d03af8a97c4b9a6162acbc3a727384bb8a86.tar.bz2
scala-cc57d03af8a97c4b9a6162acbc3a727384bb8a86.zip
Merged revisions 22594-22595 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r22594 | dubochet | 2010-07-19 17:11:30 +0200 (Mon, 19 Jul 2010) | 1 line [scaladoc] Singleton types (`this.type`) are correctly printed. Closes #1445. Review by malayeri. ........ r22595 | odersky | 2010-07-19 17:19:45 +0200 (Mon, 19 Jul 2010) | 1 line added missing file. ........
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala11
-rw-r--r--src/compiler/scala/tools/nsc/util/InterruptReq.scala28
2 files changed, 38 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
index 2e4e4f83bc..87242eebf5 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -125,7 +125,14 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def inheritedFrom =
if (inTemplate.sym == this.sym.owner || inTemplate.sym.isPackage) Nil else
makeTemplate(this.sym.owner) :: (sym.allOverriddenSymbols map { os => makeTemplate(os.owner) })
- def resultType = makeType(sym.tpe.finalResultType, inTemplate, sym)
+ def resultType = {
+ def resultTpe(tpe: Type): Type = tpe match { // similar to finalResultType, except that it leaves singleton types alone
+ case PolyType(_, res) => resultTpe(res)
+ case MethodType(_, res) => resultTpe(res)
+ case _ => tpe
+ }
+ makeType(resultTpe(sym.tpe), inTemplate, sym)
+ }
def isDef = false
def isVal = false
def isLazyVal = false
@@ -451,6 +458,8 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
if (sym.isClass || sym.isModule || sym == NoSymbol) sym else ownerTpl(sym.owner)
val tpe =
if (thisFactory.settings.useStupidTypes.value) aType else {
+ def ownerTpl(sym: Symbol): Symbol =
+ if (sym.isClass || sym.isModule || sym == NoSymbol) sym else ownerTpl(sym.owner)
val fixedSym = if (inTpl.sym.isModule) inTpl.sym.moduleClass else inTpl.sym
aType.asSeenFrom(fixedSym.thisType, ownerTpl(dclSym))
}
diff --git a/src/compiler/scala/tools/nsc/util/InterruptReq.scala b/src/compiler/scala/tools/nsc/util/InterruptReq.scala
new file mode 100644
index 0000000000..aa7804acbe
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/util/InterruptReq.scala
@@ -0,0 +1,28 @@
+package scala.tools.nsc
+package util
+
+/** A class of work items to be used in interrupt requests.
+ */
+abstract class InterruptReq {
+ /** The result type of the operation
+ */
+ type R
+
+ /** The operation to be performed */
+ protected val todo: () => R
+
+ /** The result provided */
+ private var result: Option[R] = None
+
+ /** To be called from interrupted server to execute demanded task */
+ def execute(): Unit = synchronized {
+ result = Some(todo())
+ notify()
+ }
+
+ /** To be called from interrupting client to get result fo interrupt */
+ def getResult(): R = synchronized {
+ while (result.isEmpty) wait()
+ result.get
+ }
+}