diff options
Diffstat (limited to 'src/Model/DocumentationResolver.kt')
-rw-r--r-- | src/Model/DocumentationResolver.kt | 22 |
1 files changed, 10 insertions, 12 deletions
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 |