aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-12 01:54:28 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-12 01:54:28 +0400
commit1fc4fca76592bb540f9ed124fa8be4b991dfafeb (patch)
tree4df86f543abee18fbb00399d1ff5f2980101c7c1 /src
parent992bf22a5e2209e8305ce86255518c4dd918894d (diff)
downloaddokka-1fc4fca76592bb540f9ed124fa8be4b991dfafeb.tar.gz
dokka-1fc4fca76592bb540f9ed124fa8be4b991dfafeb.tar.bz2
dokka-1fc4fca76592bb540f9ed124fa8be4b991dfafeb.zip
Cleanup and naming.
Diffstat (limited to 'src')
-rw-r--r--src/Model/DocumentationModel.kt2
-rw-r--r--src/Model/DocumentationResolver.kt22
2 files changed, 11 insertions, 13 deletions
diff --git a/src/Model/DocumentationModel.kt b/src/Model/DocumentationModel.kt
index c5dd6603..aa8d9a6b 100644
--- a/src/Model/DocumentationModel.kt
+++ b/src/Model/DocumentationModel.kt
@@ -88,7 +88,7 @@ fun BindingContext.createDocumentationModel(file: JetFile): DocumentationModel {
val visitor = DocumentationNodeBuilder(this)
packageFragment.accept(DocumentationBuildingVisitor(this, visitor), model)
- model.resolveAll()
+ model.checkResolve()
return model
}
diff --git a/src/Model/DocumentationResolver.kt b/src/Model/DocumentationResolver.kt
index 40968f4f..e69a70f8 100644
--- a/src/Model/DocumentationResolver.kt
+++ b/src/Model/DocumentationResolver.kt
@@ -3,21 +3,23 @@ package org.jetbrains.dokka
import org.jetbrains.jet.lang.resolve.name.*
import org.jetbrains.jet.lang.descriptors.*
-fun DocumentationNode.resolve() {
+fun DocumentationNode.checkResolve() {
+ val parentScope = scope
+
for (item in details + members) {
val symbolName = item.name
val symbol: DeclarationDescriptor? = when (item.kind) {
- DocumentationNodeKind.Receiver -> (scope.getContainingDeclaration() as FunctionDescriptor).getReceiverParameter()
- DocumentationNodeKind.Parameter -> scope.getLocalVariable(Name.guess(symbolName))
- DocumentationNodeKind.Function -> scope.getFunctions(Name.guess(symbolName)).firstOrNull()
- DocumentationNodeKind.Property -> scope.getProperties(Name.guess(symbolName)).firstOrNull()
- DocumentationNodeKind.Constructor -> scope.getFunctions(Name.guess(symbolName)).firstOrNull()
+ DocumentationNodeKind.Receiver -> (parentScope.getContainingDeclaration() as FunctionDescriptor).getReceiverParameter()
+ DocumentationNodeKind.Parameter -> parentScope.getLocalVariable(Name.guess(symbolName))
+ DocumentationNodeKind.Function -> parentScope.getFunctions(Name.guess(symbolName)).firstOrNull()
+ DocumentationNodeKind.Property -> parentScope.getProperties(Name.guess(symbolName)).firstOrNull()
+ DocumentationNodeKind.Constructor -> parentScope.getFunctions(Name.guess(symbolName)).firstOrNull()
DocumentationNodeKind.Package -> {
// TODO: do not resolve constructors and packages for now
item.scope.getContainingDeclaration()
}
- else -> scope.getClassifier(Name.guess(symbolName))
+ else -> parentScope.getClassifier(Name.guess(symbolName))
}
if (symbol == null)
@@ -25,10 +27,6 @@ fun DocumentationNode.resolve() {
}
for (reference in allReferences().filterNot { it.kind == DocumentationReferenceKind.Owner }) {
- reference.to.resolve()
+ reference.to.checkResolve()
}
-}
-
-fun DocumentationModel.resolveAll() {
- resolve()
} \ No newline at end of file