diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-05-03 08:27:26 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-05-03 08:27:26 +0000 |
commit | 3f1f0a4947cd70089d70254d99a90cf907420a92 (patch) | |
tree | a866664c4fceaed76b4542efc18e96d1253de45e /src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | |
parent | 0bfaa0baf4aa7eed7f14839caf73d167ea074a75 (diff) | |
download | scala-3f1f0a4947cd70089d70254d99a90cf907420a92.tar.gz scala-3f1f0a4947cd70089d70254d99a90cf907420a92.tar.bz2 scala-3f1f0a4947cd70089d70254d99a90cf907420a92.zip |
rewrite of nested objects implementation.
review by odersky, dragos and whoever feels like it.
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index db616e9657..2798d856f9 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -241,7 +241,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory def isDocTemplate = true def companion = sym.companionSymbol match { case NoSymbol => None - case comSym if !isEmptyJavaObject(comSym) && (comSym.isClass || comSym.isModule || isNestedObjectLazyVal(comSym)) => + case comSym if !isEmptyJavaObject(comSym) && (comSym.isClass || comSym.isModule) => Some(makeDocTemplate(comSym, inTpl)) case _ => None } @@ -387,12 +387,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory members collect { case d: Constructor => d } def primaryConstructor = constructors find { _.isPrimary } } - else if (isNestedObjectLazyVal(bSym)) { - new DocTemplateImpl(bSym, minimumInTpl) with Object { - override def isObject = true - override def isLazyVal = false - } - } else + else throw new Error("'" + bSym + "' that isn't a class, trait or object cannot be built as a documentable template") } @@ -432,11 +427,6 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory def makeMember0(bSym: Symbol): Option[MemberImpl] = { if (bSym.isGetter && bSym.isLazy) - if (isNestedObjectLazyVal(bSym)) - if (templateShouldDocument(bSym)) - Some(makeDocTemplate(bSym, inTpl)) - else None - else Some(new NonTemplateMemberImpl(bSym, inTpl) with Val { override lazy val comment = // The analyser does not duplicate the lazy val's DocDef when it introduces its accessor. thisFactory.comment(bSym.accessed, inTpl) // This hack should be removed after analyser is fixed. @@ -644,16 +634,12 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { thisFactory ( aSym.owner == NoSymbol || templateShouldDocument(aSym.owner) ) && !isEmptyJavaObject(aSym) } - def isNestedObjectLazyVal(aSym: Symbol): Boolean = { - aSym.isLazyAccessor && !aSym.isRootPackage && !aSym.owner.isPackageClass - } - def isEmptyJavaObject(aSym: Symbol): Boolean = { def hasMembers = aSym.info.members.exists(s => localShouldDocument(s) && (!s.isConstructor || s.owner == aSym)) aSym.isModule && aSym.isJavaDefined && !hasMembers } def localShouldDocument(aSym: Symbol): Boolean = { - !aSym.isPrivate && (aSym.isProtected || aSym.privateWithin == NoSymbol) && (!aSym.isSynthetic || isNestedObjectLazyVal(aSym)) + !aSym.isPrivate && (aSym.isProtected || aSym.privateWithin == NoSymbol) && !aSym.isSynthetic } } |