Skip to content

Commit c54432c

Browse files
committed
Removed code from scaladoc.
Nobody is immune!
1 parent 009c57d commit c54432c

File tree

9 files changed

+13
-131
lines changed

9 files changed

+13
-131
lines changed

src/compiler/scala/tools/nsc/ast/DocComments.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ trait DocComments { self: Global =>
2121
/** The raw doc comment map */
2222
val docComments = mutable.HashMap[Symbol, DocComment]()
2323

24-
/** Associate comment with symbol `sym` at position `pos`. */
25-
def docComment(sym: Symbol, docStr: String, pos: Position = NoPosition) =
26-
if ((sym ne null) && (sym ne NoSymbol))
27-
docComments += (sym -> DocComment(docStr, pos))
28-
2924
/** The raw doc comment of symbol `sym`, as it appears in the source text, "" if missing.
3025
*/
3126
def rawDocComment(sym: Symbol): String =
@@ -120,8 +115,6 @@ trait DocComments { self: Global =>
120115
getDocComment(sym) map getUseCases getOrElse List()
121116
}
122117

123-
def useCases(sym: Symbol): List[(Symbol, String, Position)] = useCases(sym, sym.enclClass)
124-
125118
/** Returns the javadoc format of doc comment string `s`, including wiki expansion
126119
*/
127120
def toJavaDoc(s: String): String = expandWiki(s)

src/compiler/scala/tools/nsc/doc/html/Page.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ abstract class Page {
8888
def relativeLinkTo(destClass: TemplateEntity): String =
8989
relativeLinkTo(templateToPath(destClass))
9090

91-
/** A relative link from this page to some destination page in the Scaladoc site.
92-
* @param destPage The page that the link will point to. */
93-
def relativeLinkTo(destPage: HtmlPage): String = {
94-
relativeLinkTo(destPage.path)
95-
}
96-
9791
/** A relative link from this page to some destination path.
9892
* @param destPath The path that the link will point to. */
9993
def relativeLinkTo(destPath: List[String]): String = {

src/compiler/scala/tools/nsc/doc/model/Entity.scala

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ import diagram._
2323
* - type and value parameters;
2424
* - annotations. */
2525
trait Entity {
26-
27-
/** Similar to symbols, so we can track entities */
28-
def id: Int
29-
3026
/** The name of the entity. Note that the name does not qualify this entity uniquely; use its `qualifiedName`
3127
* instead. */
3228
def name : String
@@ -59,9 +55,6 @@ trait Entity {
5955

6056
/** Indicates whether this entity lives in the types namespace (classes, traits, abstract/alias types) */
6157
def isType: Boolean
62-
63-
/** Indicates whether this entity lives in the terms namespace (objects, packages, methods, values) */
64-
def isTerm: Boolean
6558
}
6659

6760
object Entity {
@@ -97,9 +90,6 @@ trait TemplateEntity extends Entity {
9790
/** Whether documentation is available for this template. */
9891
def isDocTemplate: Boolean
9992

100-
/** Whether documentation is available for this template. */
101-
def isNoDocMemberTemplate: Boolean
102-
10393
/** Whether this template is a case class. */
10494
def isCaseClass: Boolean
10595

@@ -174,12 +164,6 @@ trait MemberEntity extends Entity {
174164
/** Whether this member is an abstract type. */
175165
def isAbstractType: Boolean
176166

177-
/** Whether this member is a template. */
178-
def isTemplate: Boolean
179-
180-
/** Whether this member is implicit. */
181-
def isImplicit: Boolean
182-
183167
/** Whether this member is abstract. */
184168
def isAbstract: Boolean
185169

@@ -381,14 +365,9 @@ trait RootPackage extends Package
381365

382366
/** A non-template member (method, value, lazy value, variable, constructor, alias type, and abstract type). */
383367
trait NonTemplateMemberEntity extends MemberEntity {
384-
385368
/** Whether this member is a use case. A use case is a member which does not exist in the documented code.
386369
* It corresponds to a real member, and provides a simplified, yet compatible signature for that member. */
387370
def isUseCase: Boolean
388-
389-
/** Whether this member is a bridge member. A bridge member does only exist for binary compatibility reasons
390-
* and should not appear in ScalaDoc. */
391-
def isBridge: Boolean
392371
}
393372

394373

@@ -503,12 +482,6 @@ trait ImplicitConversion {
503482
/** The result type after the conversion */
504483
def targetType: TypeEntity
505484

506-
/** The result type after the conversion
507-
* Note: not all targetTypes have a corresponding template. Examples include conversions resulting in refinement
508-
* types. Need to check it's not option!
509-
*/
510-
def targetTemplate: Option[TemplateEntity]
511-
512485
/** The components of the implicit conversion type parents */
513486
def targetTypeComponents: List[(TemplateEntity, TypeEntity)]
514487

src/compiler/scala/tools/nsc/doc/model/IndexModelFactory.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ object IndexModelFactory {
1717

1818
object result extends mutable.HashMap[Char,SymbolMap] {
1919

20-
/* Owner template ordering */
21-
implicit def orderingSet = math.Ordering.String.on { x: MemberEntity => x.name.toLowerCase }
2220
/* symbol name ordering */
2321
implicit def orderingMap = math.Ordering.String.on { x: String => x.toLowerCase }
2422

src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
4343
def modelFinished: Boolean = _modelFinished
4444
private var universe: Universe = null
4545

46-
protected def closestPackage(sym: Symbol) = {
47-
if (sym.isPackage || sym.isPackageClass) sym
48-
else sym.enclosingPackage
49-
}
50-
5146
def makeModel: Option[Universe] = {
5247
val universe = new Universe { thisUniverse =>
5348
thisFactory.universe = thisUniverse
@@ -77,7 +72,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
7772
/* ============== IMPLEMENTATION PROVIDING ENTITY TYPES ============== */
7873

7974
abstract class EntityImpl(val sym: Symbol, val inTpl: TemplateImpl) extends Entity {
80-
val id = { ids += 1; ids }
8175
val name = optimize(sym.nameString)
8276
val universe = thisFactory.universe
8377

@@ -91,7 +85,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
9185
def annotations = sym.annotations.map(makeAnnotation)
9286
def inPackageObject: Boolean = sym.owner.isModuleClass && sym.owner.sourceModule.isPackageObject
9387
def isType = sym.name.isTypeName
94-
def isTerm = sym.name.isTermName
9588
}
9689

9790
trait TemplateImpl extends EntityImpl with TemplateEntity {
@@ -103,7 +96,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
10396
def isObject = sym.isModule && !sym.isPackage
10497
def isCaseClass = sym.isCaseClass
10598
def isRootPackage = false
106-
def isNoDocMemberTemplate = false
10799
def selfType = if (sym.thisSym eq sym) None else Some(makeType(sym.thisSym.typeOfThis, this))
108100
}
109101

@@ -178,9 +170,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
178170
})
179171
else
180172
None
181-
def inheritedFrom =
182-
if (inTemplate.sym == this.sym.owner || inTemplate.sym.isPackage) Nil else
183-
makeTemplate(this.sym.owner) :: (sym.allOverriddenSymbols map { os => makeTemplate(os.owner) })
173+
184174
def resultType = {
185175
def resultTpe(tpe: Type): Type = tpe match { // similar to finalResultType, except that it leaves singleton types alone
186176
case PolyType(_, res) => resultTpe(res)
@@ -195,15 +185,14 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
195185
def isVal = false
196186
def isLazyVal = false
197187
def isVar = false
198-
def isImplicit = sym.isImplicit
199188
def isConstructor = false
200189
def isAliasType = false
201190
def isAbstractType = false
202191
def isAbstract =
203192
// for the explanation of conversion == null see comment on flags
204193
((!sym.isTrait && ((sym hasFlag Flags.ABSTRACT) || (sym hasFlag Flags.DEFERRED)) && (!isImplicitlyInherited)) ||
205194
sym.isAbstractClass || sym.isAbstractType) && !sym.isSynthetic
206-
def isTemplate = false
195+
207196
def signature = externalSignature(sym)
208197
lazy val signatureCompat = {
209198

@@ -257,25 +246,10 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
257246
*/
258247
abstract class MemberTemplateImpl(sym: Symbol, inTpl: DocTemplateImpl) extends MemberImpl(sym, inTpl) with TemplateImpl with HigherKindedImpl with MemberTemplateEntity {
259248
// no templates cache for this class, each owner gets its own instance
260-
override def isTemplate = true
261249
def isDocTemplate = false
262-
override def isNoDocMemberTemplate = true
263250
lazy val definitionName = optimize(inDefinitionTemplates.head.qualifiedName + "." + name)
264251
def valueParams: List[List[ValueParam]] = Nil /** TODO, these are now only computed for DocTemplates */
265252

266-
// Seems unused
267-
// def parentTemplates =
268-
// if (sym.isPackage || sym == AnyClass)
269-
// List()
270-
// else
271-
// sym.tpe.parents.flatMap { tpe: Type =>
272-
// val tSym = tpe.typeSymbol
273-
// if (tSym != NoSymbol)
274-
// List(makeTemplate(tSym))
275-
// else
276-
// List()
277-
// } filter (_.isInstanceOf[DocTemplateEntity])
278-
279253
def parentTypes =
280254
if (sym.isPackage || sym == AnyClass) List() else {
281255
val tps = (this match {
@@ -380,9 +354,9 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
380354
lazy val memberSyms = sym.info.members.filter(s => membersShouldDocument(s, this)).toList
381355

382356
// the inherited templates (classes, traits or objects)
383-
var memberSymsLazy = memberSyms.filter(t => templateShouldDocument(t, this) && !inOriginalOwner(t, this))
357+
val memberSymsLazy = memberSyms.filter(t => templateShouldDocument(t, this) && !inOriginalOwner(t, this))
384358
// the direct members (methods, values, vars, types and directly contained templates)
385-
var memberSymsEager = memberSyms.filter(!memberSymsLazy.contains(_))
359+
val memberSymsEager = memberSyms.filter(!memberSymsLazy.contains(_))
386360
// the members generated by the symbols in memberSymsEager
387361
val ownMembers = (memberSymsEager.flatMap(makeMember(_, None, this)))
388362

@@ -438,7 +412,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
438412
else List()
439413
)
440414

441-
override def isTemplate = true
442415
override def isDocTemplate = true
443416
private[this] lazy val companionSymbol =
444417
if (sym.isAliasType || sym.isAbstractType) {
@@ -545,7 +518,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
545518
val qualifiedName = conversion.fold(inDefinitionTemplates.head.qualifiedName)(_.conversionQualifiedName)
546519
optimize(qualifiedName + "#" + name)
547520
}
548-
def isBridge = sym.isBridge
549521
def isUseCase = useCaseOf.isDefined
550522
override def byConversion: Option[ImplicitConversionImpl] = conversion
551523
override def isImplicitlyInherited = { assert(modelFinished); conversion.isDefined }
@@ -707,7 +679,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
707679
override def inTemplate = this
708680
override def toRoot = this :: Nil
709681
override def qualifiedName = "_root_"
710-
override def inheritedFrom = Nil
711682
override def isRootPackage = true
712683
override lazy val memberSyms =
713684
(bSym.info.members ++ EmptyPackage.info.members).toList filter { s =>
@@ -857,12 +828,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
857828
inTpl.members.find(_.sym == aSym)
858829
}
859830

860-
@deprecated("Use `findLinkTarget` instead.", "2.10.0")
861-
def findTemplate(query: String): Option[DocTemplateImpl] = {
862-
assert(modelFinished)
863-
docTemplatesCache.values find { (tpl: DocTemplateImpl) => tpl.qualifiedName == query && !packageDropped(tpl) && !tpl.isObject }
864-
}
865-
866831
def findTemplateMaybe(aSym: Symbol): Option[DocTemplateImpl] = {
867832
assert(modelFinished)
868833
docTemplatesCache.get(normalizeTemplate(aSym)).filterNot(packageDropped(_))

src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,6 @@ trait ModelFactoryImplicitSupport {
345345
makeRootPackage
346346
}
347347

348-
def targetTemplate: Option[TemplateEntity] = toType match {
349-
// @Vlad: I'm being extra conservative in template creation -- I don't want to create templates for complex types
350-
// such as refinement types because the template can't represent the type corectly (a template corresponds to a
351-
// package, class, trait or object)
352-
case t: TypeRef => Some(makeTemplate(t.sym))
353-
case RefinedType(parents, decls) => None
354-
case _ => error("Scaladoc implicits: Could not create template for: " + toType + " of type " + toType.getClass); None
355-
}
356-
357348
def targetTypeComponents: List[(TemplateEntity, TypeEntity)] = makeParentTypes(toType, None, inTpl)
358349

359350
def convertorMethod: Either[MemberEntity, String] = {
@@ -492,14 +483,14 @@ trait ModelFactoryImplicitSupport {
492483
/**
493484
* Make implicits explicit - Not used curently
494485
*/
495-
object implicitToExplicit extends TypeMap {
496-
def apply(tp: Type): Type = mapOver(tp) match {
497-
case MethodType(params, resultType) =>
498-
MethodType(params.map(param => if (param.isImplicit) param.cloneSymbol.resetFlag(Flags.IMPLICIT) else param), resultType)
499-
case other =>
500-
other
501-
}
502-
}
486+
// object implicitToExplicit extends TypeMap {
487+
// def apply(tp: Type): Type = mapOver(tp) match {
488+
// case MethodType(params, resultType) =>
489+
// MethodType(params.map(param => if (param.isImplicit) param.cloneSymbol.resetFlag(Flags.IMPLICIT) else param), resultType)
490+
// case other =>
491+
// other
492+
// }
493+
// }
503494

504495
/**
505496
* removeImplicitParameters transforms implicit parameters from the view result type into constraints and

src/compiler/scala/tools/nsc/doc/model/comment/Comment.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ abstract class Comment {
102102
/** A usage example related to the entity. */
103103
def example: List[Body]
104104

105-
/** The comment as it appears in the source text. */
106-
def source: Option[String]
107-
108105
/** A description for the primary constructor */
109106
def constructor: Option[Body]
110107

src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory with Member
2828

2929
protected val commentCache = mutable.HashMap.empty[(global.Symbol, TemplateImpl), Comment]
3030

31-
def addCommentBody(sym: global.Symbol, inTpl: TemplateImpl, docStr: String, docPos: global.Position): global.Symbol = {
32-
commentCache += (sym, inTpl) -> parse(docStr, docStr, docPos, None)
33-
sym
34-
}
35-
3631
def comment(sym: global.Symbol, currentTpl: Option[DocTemplateImpl], inTpl: DocTemplateImpl): Option[Comment] = {
3732
val key = (sym, inTpl)
3833
if (commentCache isDefinedAt key)
@@ -132,7 +127,6 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory with Member
132127
val note = note0
133128
val example = example0
134129
val constructor = constructor0
135-
val source = source0
136130
val inheritDiagram = inheritDiagram0
137131
val contentDiagram = contentDiagram0
138132
val groupDesc = groupDesc0
@@ -957,20 +951,6 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory with Member
957951
count
958952
}
959953

960-
final def jumpUntil(chars: String): Int = {
961-
assert(chars.length > 0)
962-
var count = 0
963-
val c = chars.charAt(0)
964-
while (!check(chars) && char != endOfText) {
965-
nextChar()
966-
while (char != c && char != endOfText) {
967-
nextChar()
968-
count += 1
969-
}
970-
}
971-
count
972-
}
973-
974954
final def jumpUntil(pred: => Boolean): Int = {
975955
var count = 0
976956
while (!pred && char != endOfText) {

src/compiler/scala/tools/nsc/doc/model/diagram/Diagram.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,12 @@ case class InheritanceDiagram(thisNode: ThisNode,
3636
override def isInheritanceDiagram = true
3737
lazy val depthInfo = new DepthInfo {
3838
def maxDepth = 3
39-
def nodeDepth(node: Node) =
40-
if (node == thisNode) 1
41-
else if (superClasses.contains(node)) 0
42-
else if (subClasses.contains(node)) 2
43-
else if (incomingImplicits.contains(node) || outgoingImplicits.contains(node)) 1
44-
else -1
4539
}
4640
}
4741

4842
trait DepthInfo {
4943
/** Gives the maximum depth */
5044
def maxDepth: Int
51-
/** Gives the depth of any node in the diagram or -1 if the node is not in the diagram */
52-
def nodeDepth(node: Node): Int
5345
}
5446

5547
abstract class Node {
@@ -142,5 +134,4 @@ class ContentDiagramDepth(pack: ContentDiagram) extends DepthInfo {
142134
}
143135

144136
val maxDepth = _maxDepth
145-
def nodeDepth(node: Node) = _nodeDepth.getOrElse(node, -1)
146-
}
137+
}

0 commit comments

Comments
 (0)