summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2010-01-25 11:31:44 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2010-01-25 11:31:44 +0000
commitea7ac7b3899ce73303a582be51210277723e9d52 (patch)
treeeef9d58388040335ad0492514161c2f2b0c1bc5a /src/compiler
parent361051b4d385d8b03dd4f4f6fd0410e9a5d17626 (diff)
downloadscala-ea7ac7b3899ce73303a582be51210277723e9d52.tar.gz
scala-ea7ac7b3899ce73303a582be51210277723e9d52.tar.bz2
scala-ea7ac7b3899ce73303a582be51210277723e9d52.zip
[scaladoc] Deprecated methods are striked-out.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Template.scala9
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css8
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/Entity.scala1
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala7
4 files changed, 21 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
index ef60d5bfd7..dc47773059 100644
--- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
@@ -258,11 +258,12 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
/** name, tparams, params, result */
def signature(mbr: MemberEntity, isSelf: Boolean): NodeSeq = {
+ val isDeprecated = mbr.isDeprecated || (!mbr.comment.isEmpty && !mbr.comment.get.deprecated.isEmpty)
def inside(hasLinks: Boolean): NodeSeq =
<xml:group>
<span class="kind">{ kindToString(mbr) }</span>
<span class="symbol">
- <span class="name">{ if (mbr.isConstructor) tpl.name else mbr.name }</span>{
+ <span class={"name" + (if(isDeprecated) " deprecated" else "") }>{ if (mbr.isConstructor) tpl.name else mbr.name }</span>{
def tparamsToHtml(tpss: List[TypeParam]): NodeSeq =
if (tpss.isEmpty) NodeSeq.Empty else {
def tparam0(tp: TypeParam): NodeSeq =
@@ -293,7 +294,11 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
case vl :: Nil => param0(vl)
case vl :: vls => param0(vl) ++ Text(", ") ++ params0(vls)
}
- vlsss map { vlss => <span class="params">({ params0(vlss) })</span> }
+ def implicitCheck(vlss: List[ValueParam]): NodeSeq = vlss match {
+ case vl :: vls => if(vl.isImplicit) { <span class="implicit">implicit </span> } else Text("")
+ case _ => Text("")
+ }
+ vlsss map { vlss => <span class="params">({implicitCheck(vlss) ++ params0(vlss) })</span> }
}
mbr match {
case cls: Class if cls.isCaseClass => paramsToHtml(cls.primaryConstructor.get.valueParams)
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css
index 9cd3c15180..09faf90026 100644
--- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css
+++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css
@@ -125,6 +125,14 @@ div.members > ol > li {
font-weight: bold;
}
+.signature .symbol .params .implicit {
+ font-style: italic;
+}
+
+.signature .symbol .name.deprecated {
+ text-decoration: line-through;
+}
+
.signature .symbol .params .default {
font-style: italic;
}
diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
index 00ea8b9939..53ac6740cf 100644
--- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
@@ -144,4 +144,5 @@ trait TypeParam extends ParameterEntity {
trait ValueParam extends ParameterEntity {
def resultType: TypeEntity
def defaultValue: Option[String]
+ def isImplicit: Boolean
}
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
index 809f4bedd9..7503c4dcc5 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -170,8 +170,10 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { extractor =
subClassesCache += sc
}
def subClasses = subClassesCache.toList
- protected def memberSyms = sym.info.nonPrivateMembers
- val members: List[MemberEntity] = memberSyms flatMap (makeMember(_, this))
+ protected def memberSyms =
+ // Only this class's constructors are part of its members, inherited constructors are not.
+ sym.info.nonPrivateMembers.filter(x => (!x.isConstructor || x.owner==sym))
+ val members = memberSyms flatMap (makeMember(_, this))
val templates = members partialMap { case c: DocTemplateEntity => c }
val methods = members partialMap { case d: Def => d }
val values = members partialMap { case v: Val => v }
@@ -421,6 +423,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { extractor =
else None
def resultType =
makeType(sym.tpe, inTpl, sym)
+ def isImplicit = aSym.hasFlag(Flags.IMPLICIT)
}
/** */