diff options
author | Kato Kazuyoshi <kato.kazuyoshi@gmail.com> | 2012-05-03 23:44:48 +0900 |
---|---|---|
committer | Kato Kazuyoshi <kato.kazuyoshi@gmail.com> | 2012-05-03 23:44:48 +0900 |
commit | 44797916bd4437729e1f13333eee7a2a2cb8ca58 (patch) | |
tree | 123895606a30cc6dffa63b3bfc922be4ea17a96d /src | |
parent | 6300c3033e7b852c6cbef332af6085aac6150a70 (diff) | |
download | scala-44797916bd4437729e1f13333eee7a2a2cb8ca58.tar.gz scala-44797916bd4437729e1f13333eee7a2a2cb8ca58.tar.bz2 scala-44797916bd4437729e1f13333eee7a2a2cb8ca58.zip |
Fix SI-4976 partially
If a package have a package object, generate the package's "linearization"
from the object.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index a6728654cd..9062203dcd 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -231,9 +231,10 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { Some(makeType(RefinedType(tps, EmptyScope), inTpl)) } } - val linearization: List[(TemplateEntity, TypeEntity)] = { - sym.ancestors map { ancestor => - val typeEntity = makeType(sym.info.baseType(ancestor), this) + + protected def linearizationFromSymbol(symbol: Symbol) = { + symbol.ancestors map { ancestor => + val typeEntity = makeType(symbol.info.baseType(ancestor), this) val tmplEntity = makeTemplate(ancestor) match { case tmpl: DocTemplateImpl => tmpl registerSubClass this ; tmpl case tmpl => tmpl @@ -242,6 +243,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { } } + val linearization = linearizationFromSymbol(sym) def linearizationTemplates = linearization map { _._1 } def linearizationTypes = linearization map { _._2 } @@ -282,6 +284,12 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { abstract class PackageImpl(sym: Symbol, inTpl: => PackageImpl) extends DocTemplateImpl(sym, inTpl) with Package { override def inTemplate = inTpl override def toRoot: List[PackageImpl] = this :: inTpl.toRoot + override val linearization = { + val symbol = sym.info.members.find { + s => s.isPackageObject + } getOrElse sym + linearizationFromSymbol(symbol) + } val packages = members collect { case p: Package => p } } |