diff options
Diffstat (limited to 'src')
6 files changed, 78 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala index 162da4236a..eadc404bee 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala @@ -329,10 +329,12 @@ final class BCodeAsmCommon[G <: Global](val global: G) { * Build the [[InlineInfo]] for a class symbol. */ def buildInlineInfoFromClassSymbol(classSym: Symbol, classSymToInternalName: Symbol => InternalName, methodSymToDescriptor: Symbol => String): InlineInfo = { - val selfType = { + val traitSelfType = if (classSym.isTrait && !classSym.isImplClass) { // The mixin phase uses typeOfThis for the self parameter in implementation class methods. val selfSym = classSym.typeOfThis.typeSymbol if (selfSym != classSym) Some(classSymToInternalName(selfSym)) else None + } else { + None } val isEffectivelyFinal = classSym.isEffectivelyFinal @@ -394,6 +396,6 @@ final class BCodeAsmCommon[G <: Global](val global: G) { } }).toMap - InlineInfo(selfType, isEffectivelyFinal, methodInlineInfos, warning) + InlineInfo(traitSelfType, isEffectivelyFinal, methodInlineInfos, warning) } } diff --git a/src/scaladoc/scala/tools/nsc/doc/Index.scala b/src/scaladoc/scala/tools/nsc/doc/Index.scala index 84545e9201..a11ca38a86 100644 --- a/src/scaladoc/scala/tools/nsc/doc/Index.scala +++ b/src/scaladoc/scala/tools/nsc/doc/Index.scala @@ -11,4 +11,6 @@ trait Index { type SymbolMap = SortedMap[String, SortedSet[model.MemberEntity]] def firstLetterIndex: Map[Char, SymbolMap] + + def hasDeprecatedMembers: Boolean } diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala index 61ab18d42d..8313d842e5 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala @@ -123,6 +123,8 @@ class HtmlFactory(val universe: doc.Universe, index: doc.Index) { new page.Index(universe, index) writeFor this new page.IndexScript(universe, index) writeFor this + if (index.hasDeprecatedMembers) + new page.DeprecatedIndex(universe, index) writeFor this try { writeTemplates(_ writeFor this) for (letter <- index.firstLetterIndex) { diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala new file mode 100755 index 0000000000..f257153bd7 --- /dev/null +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala @@ -0,0 +1,58 @@ +/* NSC -- new Scala compiler + * Copyright 2007-2013 LAMP/EPFL + */ + +package scala +package tools +package nsc +package doc +package html +package page + +import doc.model._ + +class DeprecatedIndex(universe: Universe, index: doc.Index) extends HtmlPage { + + def path = List("deprecated-list.html") + + def title = { + val s = universe.settings + ( if (!s.doctitle.isDefault) s.doctitle.value else "" ) + + ( if (!s.docversion.isDefault) (" " + s.docversion.value) else "" ) + } + + def headers = + <xml:group> + <link href={ relativeLinkTo(List("ref-index.css", "lib")) } media="screen" type="text/css" rel="stylesheet"/> + <script type="text/javascript" src={ relativeLinkTo{List("jquery.js", "lib")} }></script> + </xml:group> + + + private def entry(name: String, methods: Iterable[MemberEntity]) = { + val occurrences = methods.filter(_.deprecation.isDefined).map(method => + templateToHtml(method.inDefinitionTemplates.head) + ).toList.distinct + + <div class="entry"> + <div class="name">{ name }</div> + <div class="occurrences">{ + for (owner <- occurrences) yield owner ++ scala.xml.Text(" ") + }</div> + </div> + } + + def deprecatedEntries = { + val available = ('_' +: ('a' to 'z')).flatMap(index.firstLetterIndex.get) + + for (group <- available; + value <- group if value._2.find(_.deprecation.isDefined).isDefined) + yield value + } + + def body = + <body>{ + for(value <- deprecatedEntries) yield + entry(value._1, value._2.view) + }</body> + +} diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala index ce3a5eb1fc..6bfe480e33 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala @@ -61,12 +61,17 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage { } } + def deprecated: NodeSeq = if (index.hasDeprecatedMembers) + <a target="template" href="deprecated-list.html">deprecated</a> + else + <span>deprecated</span> + def browser = <div id="browser" class="ui-layout-west"> <div class="ui-west-center"> <div id="filter"> <div id="textfilter"></div> - <div id="letters">{ letters }</div> + <div id="letters">{ letters } – { deprecated }</div> </div> <div class="pack" id="tpl">{ def packageElem(pack: model.Package): NodeSeq = { diff --git a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala index 643a089aae..ad53dc6bfa 100755 --- a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala @@ -14,10 +14,12 @@ object IndexModelFactory { def makeIndex(universe: Universe): Index = new Index { - lazy val firstLetterIndex: Map[Char, SymbolMap] = { + lazy val (firstLetterIndex, hasDeprecatedMembers): (Map[Char, SymbolMap], Boolean) = { object result extends mutable.HashMap[Char,SymbolMap] { + var deprecated = false + /* symbol name ordering */ implicit def orderingMap = math.Ordering.String @@ -32,6 +34,8 @@ object IndexModelFactory { val members = letter.get(d.name).getOrElse { SortedSet.empty[MemberEntity](Ordering.by { _.toString }) } + d + if (!deprecated && members.find(_.deprecation.isDefined).isDefined) + deprecated = true this(firstLetter) = letter + (d.name -> members) } } @@ -50,7 +54,7 @@ object IndexModelFactory { gather(universe.rootPackage) - result.toMap + (result.toMap, result.deprecated) } } } |