summaryrefslogtreecommitdiff
path: root/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
diff options
context:
space:
mode:
authorEugene Vigdorchik <eugene.vigdorchik@gmail.com>2013-04-26 16:39:20 +0400
committerEugene Vigdorchik <eugene.vigdorchik@gmail.com>2013-05-16 16:10:11 +0400
commitc88f7338882c8ae81f1004407bc8c21b1cbe7b36 (patch)
tree5cae494f103701b93d84c62875386196f270bf4e /src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
parent5819b78c25c9cba25fc84018d3905fe265bb4e18 (diff)
downloadscala-c88f7338882c8ae81f1004407bc8c21b1cbe7b36.tar.gz
scala-c88f7338882c8ae81f1004407bc8c21b1cbe7b36.tar.bz2
scala-c88f7338882c8ae81f1004407bc8c21b1cbe7b36.zip
Improve code style in the Scaladoc implementation.
It fixes the following inefficiences or code style violations: - Explicit asInstanceOf calls. - Boxing symbols instead of using plain NoSymbol. - Matching `this` instead of late-binding.
Diffstat (limited to 'src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala')
-rwxr-xr-xsrc/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
index ef0a013ff2..cd1d604843 100755
--- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
@@ -22,7 +22,7 @@ import scala.language.postfixOps
trait CommentFactoryBase { this: MemberLookupBase =>
val global: Global
- import global.{ reporter, Symbol }
+ import global.{ reporter, Symbol, NoSymbol }
/* Creates comments with necessary arguments */
def createComment (
@@ -186,7 +186,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
* @param comment The expanded comment string (including start and end markers) to be parsed.
* @param src The raw comment source string.
* @param pos The position of the comment in source. */
- protected def parseAtSymbol(comment: String, src: String, pos: Position, siteOpt: Option[Symbol] = None): Comment = {
+ protected def parseAtSymbol(comment: String, src: String, pos: Position, site: Symbol = NoSymbol): Comment = {
/** The cleaned raw comment as a list of lines. Cleaning removes comment
* start and end markers, line start markers and unnecessary whitespace. */
def clean(comment: String): List[String] = {
@@ -312,7 +312,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
val tagsWithoutDiagram = tags.filterNot(pair => stripTags.contains(pair._1))
val bodyTags: mutable.Map[TagKey, List[Body]] =
- mutable.Map(tagsWithoutDiagram mapValues {tag => tag map (parseWikiAtSymbol(_, pos, siteOpt))} toSeq: _*)
+ mutable.Map(tagsWithoutDiagram mapValues {tag => tag map (parseWikiAtSymbol(_, pos, site))} toSeq: _*)
def oneTag(key: SimpleTagKey): Option[Body] =
((bodyTags remove key): @unchecked) match {
@@ -345,7 +345,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
}
val com = createComment (
- body0 = Some(parseWikiAtSymbol(docBody.toString, pos, siteOpt)),
+ body0 = Some(parseWikiAtSymbol(docBody.toString, pos, site)),
authors0 = allTags(SimpleTagKey("author")),
see0 = allTags(SimpleTagKey("see")),
result0 = oneTag(SimpleTagKey("return")),
@@ -385,14 +385,14 @@ trait CommentFactoryBase { this: MemberLookupBase =>
* - Removed start-of-line star and one whitespace afterwards (if present).
* - Removed all end-of-line whitespace.
* - Only `endOfLine` is used to mark line endings. */
- def parseWikiAtSymbol(string: String, pos: Position, siteOpt: Option[Symbol]): Body = new WikiParser(string, pos, siteOpt).document()
+ def parseWikiAtSymbol(string: String, pos: Position, site: Symbol): Body = new WikiParser(string, pos, site).document()
/** TODO
*
* @author Ingo Maier
* @author Manohar Jonnalagedda
* @author Gilles Dubochet */
- protected final class WikiParser(val buffer: String, pos: Position, siteOpt: Option[Symbol]) extends CharReader(buffer) { wiki =>
+ protected final class WikiParser(val buffer: String, pos: Position, site: Symbol) extends CharReader(buffer) { wiki =>
var summaryParsed = false
def document(): Body = {
@@ -694,7 +694,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
case (SchemeUri(uri), optTitle) =>
Link(uri, optTitle getOrElse Text(uri))
case (qualName, optTitle) =>
- makeEntityLink(optTitle getOrElse Text(target), pos, target, siteOpt)
+ makeEntityLink(optTitle getOrElse Text(target), pos, target, site)
}
}