diff options
author | Vlad Ureche <vlad.ureche@gmail.com> | 2012-07-12 14:08:34 +0200 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@gmail.com> | 2012-07-16 23:41:43 +0200 |
commit | f881249ba19084b194c0db07fd36ab2a68af5228 (patch) | |
tree | fddbf2a6106e158cf0762e9cc37c0eab9d5c0800 /src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | |
parent | f916434c119289773e5aad88c633c30f68a12e14 (diff) | |
download | scala-f881249ba19084b194c0db07fd36ab2a68af5228.tar.gz scala-f881249ba19084b194c0db07fd36ab2a68af5228.tar.bz2 scala-f881249ba19084b194c0db07fd36ab2a68af5228.zip |
Scaladoc: Inherited templates in diagrams
Related to SI-3314, where we started showing inherited templates
that were normally not documented. This patch corrects a problem
in parentTypes that was preventing inherited templates from being
displayed in diagrams.
Also renamed:
PackageDiagram => ContentDiagram
ClassDiagram => InheritanceDiagram
which should have been done much earlier
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | 22 |
1 files changed, 21 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 2efbfbe43c..61b4267f3c 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -858,8 +858,28 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { parents else parents.filterNot((p: Type) => ignoreParents(p.typeSymbol)) + + /** Returns: + * - a DocTemplate if the type's symbol is documented + * - a NoDocTemplateMember if the type's symbol is not documented in its parent but in another template + * - a NoDocTemplate if the type's symbol is not documented at all */ + def makeTemplateOrMemberTemplate(parent: Type): TemplateImpl = { + def noDocTemplate = makeTemplate(parent.typeSymbol) + findTemplateMaybe(parent.typeSymbol) match { + case Some(tpl) => tpl + case None => parent match { + case TypeRef(pre, sym, args) => + findTemplateMaybe(pre.typeSymbol) match { + case Some(tpl) => findMember(parent.typeSymbol, tpl).collect({case t: TemplateImpl => t}).getOrElse(noDocTemplate) + case None => noDocTemplate + } + case _ => noDocTemplate + } + } + } + filtParents.map(parent => { - val templateEntity = makeTemplate(parent.typeSymbol) + val templateEntity = makeTemplateOrMemberTemplate(parent) val typeEntity = makeType(parent, inTpl) (templateEntity, typeEntity) }) |