summaryrefslogtreecommitdiff
path: root/src/scaladoc
diff options
context:
space:
mode:
authorJanek Bogucki <janekdb@gmail.com>2015-11-20 22:33:43 +0000
committerJanek Bogucki <janekdb@gmail.com>2015-11-20 22:33:43 +0000
commitf0f7dcdb124d212d82ae7e0ea32f88175f6a664f (patch)
tree91e5353341ff9f27b33bb9372a14df2880f0a0e5 /src/scaladoc
parent72b855f978b1d2695ca4a2ae942a537c6a6e8f54 (diff)
downloadscala-f0f7dcdb124d212d82ae7e0ea32f88175f6a664f.tar.gz
scala-f0f7dcdb124d212d82ae7e0ea32f88175f6a664f.tar.bz2
scala-f0f7dcdb124d212d82ae7e0ea32f88175f6a664f.zip
Refactor excluded qname test to be more data like
This refactoring extracts data from code into a form which is closer to configuration data. This is a step change toward making this configurable.
Diffstat (limited to 'src/scaladoc')
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/Settings.scala34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/Settings.scala b/src/scaladoc/scala/tools/nsc/doc/Settings.scala
index 90efa4e595..0dd308eb8c 100644
--- a/src/scaladoc/scala/tools/nsc/doc/Settings.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/Settings.scala
@@ -275,24 +275,36 @@ class Settings(error: String => Unit, val printMsg: String => Unit = println(_))
("scala.reflect.ClassManifest" -> ((tparam: String) => tparam + " is accompanied by a ClassManifest, which is a runtime representation of its type that survives erasure")) +
("scala.reflect.OptManifest" -> ((tparam: String) => tparam + " is accompanied by an OptManifest, which can be either a runtime representation of its type or the NoManifest, which means the runtime type is not available")) +
("scala.reflect.ClassTag" -> ((tparam: String) => tparam + " is accompanied by a ClassTag, which is a runtime representation of its type that survives erasure")) +
- ("scala.reflect.api.TypeTags.WeakTypeTag" -> ((tparam: String) => tparam + " is accompanied by an WeakTypeTag, which is a runtime representation of its type that survives erasure")) +
+ ("scala.reflect.api.TypeTags.WeakTypeTag" -> ((tparam: String) => tparam + " is accompanied by a WeakTypeTag, which is a runtime representation of its type that survives erasure")) +
("scala.reflect.api.TypeTags.TypeTag" -> ((tparam: String) => tparam + " is accompanied by a TypeTag, which is a runtime representation of its type that survives erasure"))
+ private val excludedClassnamePatterns = Set(
+ """^scala.Tuple.*""",
+ """^scala.Product.*""",
+ """^scala.Function.*""",
+ """^scala.runtime.AbstractFunction.*"""
+ ) map (_.r)
+
+ private val notExcludedClasses = Set(
+ "scala.Tuple1",
+ "scala.Tuple2",
+ "scala.Product",
+ "scala.Product1",
+ "scala.Product2",
+ "scala.Function",
+ "scala.Function1",
+ "scala.Function2",
+ "scala.runtime.AbstractFunction0",
+ "scala.runtime.AbstractFunction1",
+ "scala.runtime.AbstractFunction2"
+ )
+
/**
* Set of classes to exclude from index and diagrams
* TODO: Should be configurable
*/
def isExcluded(qname: String) = {
- ( ( qname.startsWith("scala.Tuple") || qname.startsWith("scala.Product") ||
- qname.startsWith("scala.Function") || qname.startsWith("scala.runtime.AbstractFunction")
- ) && !(
- qname == "scala.Tuple1" || qname == "scala.Tuple2" ||
- qname == "scala.Product" || qname == "scala.Product1" || qname == "scala.Product2" ||
- qname == "scala.Function" || qname == "scala.Function1" || qname == "scala.Function2" ||
- qname == "scala.runtime.AbstractFunction0" || qname == "scala.runtime.AbstractFunction1" ||
- qname == "scala.runtime.AbstractFunction2"
- )
- )
+ excludedClassnamePatterns.exists(_.findFirstMatchIn(qname).isDefined) && !notExcludedClasses(qname)
}
/** Common conversion targets that affect any class in Scala */