diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Model/DocumentationModel.kt | 2 | ||||
-rw-r--r-- | src/Model/DocumentationResolver.kt | 22 |
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 |