diff options
Diffstat (limited to 'src/scaladoc')
9 files changed, 50 insertions, 41 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala index 9edd5afa13..159e16375c 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala @@ -3,7 +3,9 @@ * @author David Bernard, Manohar Jonnalagedda */ -package scala.tools.nsc +package scala +package tools +package nsc package doc package html diff --git a/src/scaladoc/scala/tools/nsc/doc/html/Page.scala b/src/scaladoc/scala/tools/nsc/doc/html/Page.scala index 91939cf3de..93950fd0a7 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/Page.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/Page.scala @@ -3,7 +3,8 @@ * @author David Bernard, Manohar Jonnalagedda */ -package scala.tools.nsc.doc.html +package scala +package tools.nsc.doc.html import scala.tools.nsc.doc.model._ import java.io.{FileOutputStream, File} diff --git a/src/scaladoc/scala/tools/nsc/doc/html/SyntaxHigh.scala b/src/scaladoc/scala/tools/nsc/doc/html/SyntaxHigh.scala index 348ea97c5b..fe0fc64033 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/SyntaxHigh.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/SyntaxHigh.scala @@ -3,7 +3,8 @@ * @author Stephane Micheloud */ -package scala.tools.nsc.doc.html +package scala +package tools.nsc.doc.html import scala.xml.NodeSeq import scala.annotation.tailrec diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala index a74c2eedbd..84ee82f994 100755 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala @@ -3,10 +3,13 @@ * @author Pedro Furlanetto */ -package scala.tools.nsc +package scala +package tools +package nsc package doc package html package page + import doc.model._ class ReferenceIndex(letter: Char, index: doc.Index, universe: Universe) extends HtmlPage { diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala index c5ccc06cf9..119d4e0143 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala @@ -3,7 +3,9 @@ * @author David Bernard, Manohar Jonnalagedda */ -package scala.tools.nsc +package scala +package tools +package nsc package doc package html package page diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala index 7d146b4a5f..4ff436bdc6 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala @@ -2,7 +2,9 @@ * @author Damien Obrist * @author Vlad Ureche */ -package scala.tools.nsc +package scala +package tools +package nsc package doc package html package page diff --git a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala index 1272906df5..53410fd4ad 100755 --- a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala @@ -3,7 +3,8 @@ * @author Pedro Furlanetto */ -package scala.tools.nsc +package scala +package tools.nsc package doc package model diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala index 5b91ef2ba5..c4e3c115be 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala @@ -1,6 +1,7 @@ /* NSC -- new Scala compiler -- Copyright 2007-2013 LAMP/EPFL */ -package scala.tools.nsc +package scala +package tools.nsc package doc package model @@ -9,11 +10,9 @@ import diagram._ import scala.collection._ import scala.util.matching.Regex - import symtab.Flags import io._ - import model.{ RootPackage => RootPackageEntity } /** This trait extracts all required information for documentation from compilation units */ @@ -819,36 +818,36 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { } } - /** */ def makeAnnotation(annot: AnnotationInfo): scala.tools.nsc.doc.model.Annotation = { val aSym = annot.symbol new EntityImpl(aSym, makeTemplate(aSym.owner)) with scala.tools.nsc.doc.model.Annotation { lazy val annotationClass = makeTemplate(annot.symbol) - val arguments = { // lazy - def annotArgs = annot.args match { - case Nil => annot.assocs collect { case (_, LiteralAnnotArg(const)) => Literal(const) } - case xs => xs - } - def noParams = annotArgs map (_ => None) - - val params: List[Option[ValueParam]] = annotationClass match { + val arguments = { + val paramsOpt: Option[List[ValueParam]] = annotationClass match { case aClass: DocTemplateEntity with Class => - (aClass.primaryConstructor map { _.valueParams.head }) match { - case Some(vps) => vps map { Some(_) } - case _ => noParams + val constr = aClass.constructors collectFirst { + case c: MemberImpl if c.sym == annot.original.symbol => c } - case _ => noParams + constr flatMap (_.valueParams.headOption) + case _ => None } - assert(params.length == annotArgs.length, (params, annotArgs)) - - params zip annotArgs flatMap { case (param, arg) => - makeTree(arg) map { tree => - new ValueArgument { - def parameter = param - def value = tree + val argTrees = annot.args map makeTree + paramsOpt match { + case Some (params) => + params zip argTrees map { case (param, tree) => + new ValueArgument { + def parameter = Some(param) + def value = tree + } + } + case None => + argTrees map { tree => + new ValueArgument { + def parameter = None + def value = tree + } } - } } } } @@ -888,9 +887,8 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { sym.name == aSym.name && sym.isParamWithDefault ) - (unit.body find (t => isCorrespondingParam(t.symbol))) match { - case Some(ValDef(_,_,_,rhs)) => makeTree(rhs) - case _ => None + unit.body find (t => isCorrespondingParam(t.symbol)) collect { + case ValDef(_,_,_,rhs) if rhs ne EmptyTree => makeTree(rhs) } case _ => None } diff --git a/src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala index b972649194..b381176b17 100755 --- a/src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala @@ -19,7 +19,7 @@ trait TreeFactory { thisTreeFactory: ModelFactory with TreeFactory => val global: Global import global._ - def makeTree(rhs: Tree): Option[TreeEntity] = { + def makeTree(rhs: Tree): TreeEntity = { val expr = new StringBuilder var refs = new immutable.TreeMap[Int, (Entity, Int)] // start, (Entity to be linked to , end) @@ -80,17 +80,16 @@ trait TreeFactory { thisTreeFactory: ModelFactory with TreeFactory => traverser.traverse(rhs) - Some(new TreeEntity { + new TreeEntity { val expression = expr.toString val refEntity = refs - }) + } } - case pos: OffsetPosition => - Some(new TreeEntity { + case _ => + new TreeEntity { val expression = rhs.toString val refEntity = new immutable.TreeMap[Int, (Entity, Int)] - }) - case _ => None + } } } } |