summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2010-07-19 09:38:25 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2010-07-19 09:38:25 +0000
commitd36dcfbf9d329684b9849cbdd6b5684b1c7ae47b (patch)
tree7cc6a2e5287cf00110a04302eb7754f040ff944a /src/compiler
parent289e6a43d40b5b47ecd4ae55b59389ad27e5508a (diff)
downloadscala-d36dcfbf9d329684b9849cbdd6b5684b1c7ae47b.tar.gz
scala-d36dcfbf9d329684b9849cbdd6b5684b1c7ae47b.tar.bz2
scala-d36dcfbf9d329684b9849cbdd6b5684b1c7ae47b.zip
[scaladoc] Adds private Scaladoc option "-Yuse-...
[scaladoc] Adds private Scaladoc option "-Yuse-stupid-types" for LAMP internal use. No review.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/doc/Settings.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/Universe.scala5
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Template.scala23
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css2
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/Entity.scala1
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala15
6 files changed, 36 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala
index f3fe8c384b..b628b3b19c 100644
--- a/src/compiler/scala/tools/nsc/doc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/doc/Settings.scala
@@ -29,6 +29,8 @@ class Settings(error: String => Unit) extends scala.tools.nsc.Settings(error) {
* If needed the sourcepath option can be used to exclude undesired initial part of the link to sources */
val docsourceurl = StringSetting ("-doc-source-url", "url", "The URL prefix where documentation will link to sources", "")
+ val useStupidTypes = BooleanSetting ("-Yuse-stupid-types", "Print the types of inherited members as seen from their original definition context. Hint: you don't want to do that!")
+
// working around issue described in r18708.
suppressVTWarn.value = true
diff --git a/src/compiler/scala/tools/nsc/doc/Universe.scala b/src/compiler/scala/tools/nsc/doc/Universe.scala
index 666a06dc4b..71b4a4a4b0 100644
--- a/src/compiler/scala/tools/nsc/doc/Universe.scala
+++ b/src/compiler/scala/tools/nsc/doc/Universe.scala
@@ -5,4 +5,7 @@ package scala.tools.nsc.doc
* @author Pedro Furlanetto
* @author Gilles Dubochet
*/
-class Universe(val settings: Settings, val rootPackage: model.Package)
+trait Universe {
+ def settings: Settings
+ def rootPackage: model.Package
+}
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 2a11905d7f..1e35a10e1d 100644
--- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
@@ -111,7 +111,18 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
{
NodeSeq fromSeq (for ((superTpl, superType) <- tpl.linearization) yield
<div class="parent" name={ superTpl.qualifiedName }>
- <h3>Inherited from { typeToHtml(superType, true) }</h3>
+ <h3>Inherited from {
+ if (tpl.universe.settings.useStupidTypes.value)
+ superTpl match {
+ case dtpl: DocTemplateEntity =>
+ val sig = signature(dtpl, false, true) \ "_"
+ sig
+ case tpl: TemplateEntity =>
+ tpl.name
+ }
+ else
+ typeToHtml(superType, true)
+ }</h3>
</div>
)
}
@@ -374,7 +385,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
}
/** name, tparams, params, result */
- def signature(mbr: MemberEntity, isSelf: Boolean): NodeSeq = {
+ def signature(mbr: MemberEntity, isSelf: Boolean, isReduced: Boolean = false): NodeSeq = {
def inside(hasLinks: Boolean): NodeSeq =
<xml:group>
<span class="kind">{ kindToString(mbr) }</span>
@@ -397,7 +408,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
}
tparamsToHtml(mbr)
}
- {
+ { if (isReduced) NodeSeq.Empty else {
def paramsToHtml(vlsss: List[List[ValueParam]]): NodeSeq = {
def param0(vl: ValueParam): NodeSeq =
// notice the }{ in the next lines, they are necessary to avoid a undesired withspace in output
@@ -425,8 +436,8 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
case dfe: Def => paramsToHtml(dfe.valueParams)
case _ => NodeSeq.Empty
}
- }
- {
+ }}
+ { if (isReduced) NodeSeq.Empty else {
mbr match {
case tpl: DocTemplateEntity if (!tpl.isPackage) =>
tpl.parentType match {
@@ -444,7 +455,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
<span class="result"> = { typeToHtml(alt.alias, hasLinks) }</span>
case _ => NodeSeq.Empty
}
- }
+ }}
</span>
</xml:group>
mbr match {
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 4ef29bf0cc..8cfd9e9ce1 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
@@ -116,7 +116,7 @@ a:hover {
font-weight: bold;
}
-#template > div.parent > h3 > a {
+#template > div.parent > h3 * {
color: white;
}
diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
index 7d4fbbfbfb..fc84ed8f6c 100644
--- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala
@@ -17,6 +17,7 @@ trait Entity {
def toRoot: List[Entity]
def qualifiedName: String
override def toString = qualifiedName
+ def universe: Universe
}
/** A class, trait, object or package. A package is represented as an instance
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
index a45a227142..285a0a2329 100644
--- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
@@ -22,13 +22,18 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def templatesCount = templatesCache.size - droppedPackages
private var modelFinished = false
+ private var universe: Universe = null
/** */
def makeModel: Universe = {
- val rootPackage =
- makeRootPackage getOrElse { throw new Error("no documentable class found in compilation units") }
- val universe = new Universe(settings, rootPackage)
+ val universe = new Universe { thisUniverse =>
+ thisFactory.universe = thisUniverse
+ val settings = thisFactory.settings
+ val rootPackage =
+ makeRootPackage getOrElse { throw new Error("no documentable class found in compilation units") }
+ }
modelFinished = true
+ thisFactory.universe = null
universe
}
@@ -52,6 +57,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def inTemplate: TemplateImpl = inTpl
def toRoot: List[EntityImpl] = this :: inTpl.toRoot
def qualifiedName = name
+ val universe = thisFactory.universe
}
/** Provides a default implementation for instances of the `WeakTemplateEntity` type. It must be instantiated as a
@@ -443,7 +449,8 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory
def makeType(aType: Type, inTpl: => TemplateImpl, dclSym: Symbol): TypeEntity = {
def ownerTpl(sym: Symbol): Symbol =
if (sym.isClass || sym.isModule || sym == NoSymbol) sym else ownerTpl(sym.owner)
- makeType(aType.asSeenFrom(inTpl.sym.thisType, ownerTpl(dclSym)), inTpl)
+ val tpe = if (thisFactory.settings.useStupidTypes.value) aType else aType.asSeenFrom(inTpl.sym.thisType, ownerTpl(dclSym))
+ makeType(tpe, inTpl)
}
/** */