summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/DocComments.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-08 09:16:30 +0000
committerPaul Phillips <paulp@improving.org>2011-01-08 09:16:30 +0000
commit701b17de262adca8f2787f3230b158cffa332254 (patch)
treefbaf7b6dc3837dbc923b408e8e9ed966187cd85b /src/compiler/scala/tools/nsc/ast/DocComments.scala
parentd45b5ceed946dbcfb9a852cc7fd25267b6b168a2 (diff)
downloadscala-701b17de262adca8f2787f3230b158cffa332254.tar.gz
scala-701b17de262adca8f2787f3230b158cffa332254.tar.bz2
scala-701b17de262adca8f2787f3230b158cffa332254.zip
Applying some short-term balm to scaladoc since...
Applying some short-term balm to scaladoc since it got all loopy after that last patch. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/DocComments.scala')
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index afaa1dbd7b..2dcaeee747 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -38,6 +38,15 @@ trait DocComments { self: SymbolTable =>
def docCommentPos(sym: Symbol): Position =
getDocComment(sym) map (_.pos) getOrElse NoPosition
+ /** A version which doesn't consider self types, as a temporary measure:
+ * an infinite loop has broken out between superComment and cookedDocComment
+ * since r23926.
+ */
+ private def allInheritedOverriddenSymbols(sym: Symbol): List[Symbol] = {
+ if (!sym.owner.isClass) Nil
+ else sym.owner.ancestors map (sym overriddenSymbol _) filter (_ != NoSymbol)
+ }
+
/** The raw doc comment of symbol `sym`, minus @usecase and @define sections, augmented by
* missing sections of an inherited doc comment.
* If a symbol does not have a doc comment but some overridden version of it does,
@@ -121,23 +130,15 @@ trait DocComments { self: SymbolTable =>
(str /: wikiReplacements) { (str1, regexRepl) => regexRepl._1 replaceAllIn(str1, regexRepl._2) }
- private def getDocComment(sym: Symbol): Option[DocComment] = docComments get sym match {
- case None => mapFind(sym.allOverriddenSymbols)(docComments get)
- case some => some
- }
+ private def getDocComment(sym: Symbol): Option[DocComment] =
+ mapFind(sym :: allInheritedOverriddenSymbols(sym))(docComments get _)
/** The cooked doc comment of an overridden symbol */
protected def superComment(sym: Symbol): Option[String] =
- sym.allOverriddenSymbols.view map { cookedDocComment(_) } find ("" !=)
+ allInheritedOverriddenSymbols(sym).iterator map (x => cookedDocComment(x)) find (_ != "")
- private def mapFind[A, B](xs: Iterable[A])(f: A => Option[B]): Option[B] = {
- var res: Option[B] = None
- val it = xs.iterator
- while (res.isEmpty && it.hasNext) {
- res = f(it.next())
- }
- res
- }
+ private def mapFind[A, B](xs: Iterable[A])(f: A => Option[B]): Option[B] =
+ xs collectFirst f.unlift
private def isMovable(str: String, sec: (Int, Int)): Boolean =
startsWithTag(str, sec, "@param") ||