Skip to content

Commit

Permalink
[Scaladoc] Self types are printed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilles Dubochet committed Jun 16, 2010
1 parent 8af697d commit 9cc51c6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/doc/DocFactory.scala
Expand Up @@ -54,7 +54,7 @@ class DocFactory(val reporter: Reporter, val settings: doc.Settings) { processor
val modelFactory = (new model.ModelFactory(compiler, settings) with model.comment.CommentFactory)
val docModel = modelFactory.makeModel
println("model contains " + modelFactory.templatesCount + " documentable templates")
(new html.HtmlFactory(docModel)) generate docModel
(new html.HtmlFactory(docModel)).generate
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala
Expand Up @@ -26,7 +26,7 @@ class HtmlFactory(val universe: Universe) {
/** Generates the Scaladoc site for a model into the site root. A scaladoc site is a set of HTML and related files
* that document a model extracted from a compiler run.
* @param model The model to generate in the form of a sequence of packages. */
def generate(universe: Universe): Unit = {
def generate : Unit = {

def copyResource(subPath: String) {
val bytes = new Streamable.Bytes {
Expand Down
8 changes: 8 additions & 0 deletions src/compiler/scala/tools/nsc/doc/html/page/Template.scala
Expand Up @@ -230,6 +230,14 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
case _ => NodeSeq.Empty
}
} ++
{ mbr match {
case dtpl: DocTemplateEntity if (isSelf && !dtpl.selfType.isEmpty) =>
<div class="block">
self type: { typeToHtml(dtpl.selfType.get, hasLinks = true) }
</div>
case _ => NodeSeq.Empty
}
} ++
{ mbr match {
case dtpl: DocTemplateEntity if (isSelf && dtpl.sourceUrl.isDefined) =>
val sourceUrl = tpl.sourceUrl.get
Expand Down
1 change: 1 addition & 0 deletions src/compiler/scala/tools/nsc/doc/model/Entity.scala
Expand Up @@ -31,6 +31,7 @@ trait TemplateEntity extends Entity {
def isClass: Boolean
def isObject: Boolean
def isDocTemplate: Boolean
def selfType : Option[TypeEntity]
}
trait NoDocTemplate extends TemplateEntity

Expand Down
1 change: 1 addition & 0 deletions src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
Expand Up @@ -63,6 +63,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def isClass = sym.isClass && !sym.isTrait
def isObject = sym.isModule && !sym.isPackage
def isRootPackage = false
def selfType = if (sym.thisSym eq sym) None else Some(makeType(sym.thisSym.typeOfThis))
}

/** Provides a default implementation for instances of the `WeakTemplateEntity` type. It must be instantiated as a
Expand Down

0 comments on commit 9cc51c6

Please sign in to comment.