diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-10-12 22:35:47 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-10-12 22:35:47 +0400 |
commit | 11355cefc9f6856054cb3760d2a339f40d22dae3 (patch) | |
tree | 8b3abf314cd517c7c0136ad5a2334b2140d69cf7 /test/src/TestAPI.kt | |
parent | cf272252a8e62d7b212e9025065a8bce4f514946 (diff) | |
download | dokka-11355cefc9f6856054cb3760d2a339f40d22dae3.tar.gz dokka-11355cefc9f6856054cb3760d2a339f40d22dae3.tar.bz2 dokka-11355cefc9f6856054cb3760d2a339f40d22dae3.zip |
Convert visitors to top-down builder
Diffstat (limited to 'test/src/TestAPI.kt')
-rw-r--r-- | test/src/TestAPI.kt | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index 309654e5..fcff75e9 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -27,18 +27,22 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> addSources(files.toList()) } - val documentation = environment.withContext<DocumentationModule> { environment, module, context -> - val packageSet = environment.getSourceFiles().map { file -> - context.getPackageFragment(file)!!.fqName - }.toSet() + val options = DocumentationOptions(includeNonPublic = true) - context.createDocumentationModule("test", module, packageSet, DocumentationOptions(includeNonPublic = true)) + val documentation = environment.withContext { environment, module, context -> + val documentationModule = DocumentationModule("test") + val documentationBuilder = DocumentationBuilder(context, options) + with(documentationBuilder) { + documentationModule.appendFiles(environment.getSourceFiles()) + } + documentationBuilder.resolveReferences(documentationModule) + documentationModule } verifier(documentation) Disposer.dispose(environment) } -fun StringBuilder.appendChildren(node: ContentNode) : StringBuilder { +fun StringBuilder.appendChildren(node: ContentNode): StringBuilder { for (child in node.children) { val childText = child.toTestString() append(childText) @@ -46,7 +50,7 @@ fun StringBuilder.appendChildren(node: ContentNode) : StringBuilder { return this } -fun StringBuilder.appendNode(node: ContentNode) : StringBuilder { +fun StringBuilder.appendNode(node: ContentNode): StringBuilder { when (node) { is ContentText -> { append(node.text) |