summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2010-06-18 16:48:05 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2010-06-18 16:48:05 +0000
commit109924d63ebc61977f843e35465d48722ed13ea9 (patch)
tree8416c0985df438acf8c0d5f1257b33f00d96e32d /src/compiler
parentcb367e28eed815419d29fb73acb2d66c7d3ecb3f (diff)
downloadscala-109924d63ebc61977f843e35465d48722ed13ea9.tar.gz
scala-109924d63ebc61977f843e35465d48722ed13ea9.tar.bz2
scala-109924d63ebc61977f843e35465d48722ed13ea9.zip
[scaladoc] Abstract members can be filtered in ...
[scaladoc] Abstract members can be filtered in or out. Pointer icons are less crazy. Review by dubochet. Contributed by Pedro Furlanetto.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Template.scala39
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css7
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js22
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/Entity.scala1
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala3
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala1
6 files changed, 64 insertions, 9 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 938ac511b6..a43c89adad 100644
--- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
@@ -79,6 +79,12 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
<ol><li class="public in">Public</li><li class="all out">All</li></ol>
</div>
}
+ {
+ <div id="impl">
+ <span class="filtertype">Impl.</span>
+ <ol><li class="concrete in">Concrete</li><li class="abstract in">Abstract</li></ol>
+ </div>
+ }
</div>
{ if (constructors.isEmpty) NodeSeq.Empty else
@@ -116,10 +122,39 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
</body>
+ def boundsToString(hi: Option[TypeEntity], lo: Option[TypeEntity]): String = {
+ def bound0(bnd: Option[TypeEntity], pre: String): String = bnd match {
+ case None => ""
+ case Some(tpe) => pre ++ tpe.toString
+ }
+ bound0(hi, "<:") ++ bound0(lo, ">:")
+ }
+
+ def tparamsToString(tpss: List[TypeParam]): String =
+ if (tpss.isEmpty) "" else {
+ def tparam0(tp: TypeParam): String =
+ tp.variance + tp.name + boundsToString(tp.hi, tp.lo)
+ def tparams0(tpss: List[TypeParam]): String = (tpss: @unchecked) match {
+ case tp :: Nil => tparam0(tp)
+ case tp :: tps => tparam0(tp) ++ ", " ++ tparams0(tps)
+ }
+ "[" + tparams0(tpss) + "]"
+ }
+
+ def defParamsToString(d: MemberEntity with Def):String = {
+ val namess = for( ps <- d.valueParams ) yield
+ for( p <- ps ) yield p.resultType.name
+ tparamsToString(d.typeParams) + namess.foldLeft("") { (s,names) => s + (names mkString("(",",",")")) }
+ }
def memberToHtml(mbr: MemberEntity): NodeSeq = {
- val attributes: List[comment.Body] = Nil
- <li name={ mbr.definitionName } visbl={ if (mbr.visibility.isProtected) "prt" else "pub" }>
+ val defParamsString = mbr match {
+ case d:MemberEntity with Def => defParamsToString(d)
+ case _ => ""
+ }
+ <li name={ mbr.definitionName } visbl={ if (mbr.visibility.isProtected) "prt" else "pub" }
+ data-isabs={ mbr.isAbstract.toString }>
+ <a id={ mbr.name +defParamsString +":"+ mbr.resultType.name}/>
{ signature(mbr, false) }
{ memberToCommentHtml(mbr, false) }
</li>
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 25ae8f9478..0a49f6296a 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
@@ -15,7 +15,6 @@ body {
}
a {
- cursor: pointer;
text-decoration: underline;
color: #69481D; /* brown */
}
@@ -311,7 +310,7 @@ p.comment {
p.shortcomment {
display: block;
margin-left: 8.7em;
- cursor: help;
+ cursor: pointer;
}
div.fullcomment {
@@ -444,7 +443,7 @@ div.fullcomment dl.paramcmts > dd + dt + dd {
padding: 4px 8px 4px 8px;
background-color: white;
display: inline-block;
- cursor: crosshair;
+ cursor: pointer;
}
#mbrsel > div > ol > li.in {
@@ -465,4 +464,4 @@ div.fullcomment dl.paramcmts > dd + dt + dd {
#mbrsel .showall {
color: #4C4C4C;
font-weight: bold;
-} \ No newline at end of file
+}
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
index 034ad666c0..7981363699 100644
--- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
+++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js
@@ -61,6 +61,24 @@ $(document).ready(function(){
filter();
};
});
+ $("#impl > ol > li.concrete").click(function() {
+ if ($(this).hasClass("out")) {
+ $(this).removeClass("out").addClass("in");
+ $("li[data-isabs='false']").show();
+ } else {
+ $(this).removeClass("in").addClass("out");
+ $("li[data-isabs='false']").hide();
+ }
+ });
+ $("#impl > ol > li.abstract").click(function() {
+ if ($(this).hasClass("out")) {
+ $(this).removeClass("out").addClass("in");
+ $("li[data-isabs='true']").show();
+ } else {
+ $(this).removeClass("in").addClass("out");
+ $("li[data-isabs='true']").hide();
+ }
+ });
$("#order > ol > li.alpha").click(function() {
if ($(this).hasClass("out")) {
$(this).removeClass("out").addClass("in");
@@ -97,7 +115,7 @@ $(document).ready(function(){
var docShowSigs = docAllSigs.filter(function(){
return $("+ div.fullcomment", $(this)).length > 0;
});
- docShowSigs.css("cursor", "help");
+ docShowSigs.css("cursor", "pointer");
docShowSigs.click(function(){
commentShowFct($("+ div.fullcomment", $(this)));
});
@@ -116,7 +134,7 @@ $(document).ready(function(){
var docToggleSigs = docAllSigs.filter(function(){
return $("+ p.shortcomment", $(this)).length > 0;
});
- docToggleSigs.css("cursor", "help");
+ docToggleSigs.css("cursor", "pointer");
docToggleSigs.click(function(){
commentToggleFct($("+ p.shortcomment", $(this)));
});
diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
index f655be7b8c..d0ce44c3f2 100644
--- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
@@ -52,6 +52,7 @@ trait MemberEntity extends Entity {
def isLazyVal: Boolean
def isVar: Boolean
def isImplicit: Boolean
+ def isAbstract: Boolean
def isConstructor: Boolean
def isAliasType: Boolean
def isAbstractType: Boolean
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
index dc84023e6a..72844201ba 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -127,6 +127,9 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def isConstructor = false
def isAliasType = false
def isAbstractType = false
+ def isAbstract =
+ ((!sym.isTrait && ((sym hasFlag Flags.ABSTRACT) || (sym hasFlag Flags.DEFERRED))) ||
+ sym.isAbstractClass || sym.isAbstractType) && !sym.isSynthetic
def isTemplate = false
}
diff --git a/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala b/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala
index 7fe2e58991..2a463959e5 100644
--- a/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala
@@ -69,4 +69,3 @@ abstract class Comment {
(version map ("@version " + _.toString)).mkString
}
-