diff options
author | Vlad Ureche <vlad.ureche@gmail.com> | 2012-03-27 10:35:40 +0200 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@gmail.com> | 2012-03-27 10:35:40 +0200 |
commit | 5632167f6cacec16d82b1961d233d7e761cf6036 (patch) | |
tree | 13cf3cdd1b8e41ddaa7c0a22d805dbbc6cfa7bb7 /src/compiler/scala/tools/nsc/doc/DocFactory.scala | |
parent | a532ba0600444b3564b6b015688ebc4cdf084ba6 (diff) | |
download | scala-5632167f6cacec16d82b1961d233d7e761cf6036.tar.gz scala-5632167f6cacec16d82b1961d233d7e761cf6036.tar.bz2 scala-5632167f6cacec16d82b1961d233d7e761cf6036.zip |
Fixes SI-5373
And adds basic support for scaladoc model tests (class
partest.ScaladocModelTest)
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/DocFactory.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/DocFactory.scala | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocFactory.scala b/src/compiler/scala/tools/nsc/doc/DocFactory.scala index 9a025b0d14..f32564f097 100644 --- a/src/compiler/scala/tools/nsc/doc/DocFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/DocFactory.scala @@ -8,7 +8,7 @@ package doc import scala.util.control.ControlThrowable import reporters.Reporter -import util.NoPosition +import util.{ NoPosition, BatchSourceFile} import io.{ File, Directory } import DocParser.Parsed @@ -46,13 +46,19 @@ class DocFactory(val reporter: Reporter, val settings: doc.Settings) { processor override def forScaladoc = true } - /** Creates a scaladoc site for all symbols defined in this call's `files`, - * as well as those defined in `files` of previous calls to the same processor. + /** Creates a scaladoc site for all symbols defined in this call's `source`, + * as well as those defined in `sources` of previous calls to the same processor. * @param files The list of paths (relative to the compiler's source path, * or absolute) of files to document. */ - def makeUniverse(files: List[String]): Option[Universe] = { + def makeUniverse(source: Either[List[String], String]): Option[Universe] = { assert(settings.docformat.value == "html") - new compiler.Run() compile files + source match { + case Left(files) => + new compiler.Run() compile files + case Right(sourceCode) => + new compiler.Run() compileSources List(new BatchSourceFile("newSource", sourceCode)) + } + if (reporter.hasErrors) return None @@ -111,7 +117,7 @@ class DocFactory(val reporter: Reporter, val settings: doc.Settings) { processor docletInstance match { case universer: Universer => - val universe = makeUniverse(files) getOrElse { throw NoCompilerRunException } + val universe = makeUniverse(Left(files)) getOrElse { throw NoCompilerRunException } universer setUniverse universe docletInstance match { |