diff options
Diffstat (limited to 'src/Model/DocumentationResolver.kt')
-rw-r--r-- | src/Model/DocumentationResolver.kt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Model/DocumentationResolver.kt b/src/Model/DocumentationResolver.kt index 70ee4aae..1d470867 100644 --- a/src/Model/DocumentationResolver.kt +++ b/src/Model/DocumentationResolver.kt @@ -1,6 +1,8 @@ package org.jetbrains.dokka import org.jetbrains.jet.lang.resolve.scopes.* +import org.jetbrains.jet.lang.resolve.name.* +import org.jetbrains.jet.lang.descriptors.FunctionDescriptor fun DocumentationNode.resolve(): DocumentationNode { @@ -8,5 +10,18 @@ fun DocumentationNode.resolve(): DocumentationNode { } fun DocumentationNode.resolve(scope: JetScope): DocumentationNode { + for (detail in details) { + val symbol = when (detail.kind) { + DocumentationNodeKind.Receiver -> (scope.getContainingDeclaration() as FunctionDescriptor).getReceiverParameter() + DocumentationNodeKind.Parameter -> scope.getLocalVariable(Name.guess(detail.name)) + DocumentationNodeKind.Function -> scope.getFunctions(Name.guess(detail.name)).single() + DocumentationNodeKind.Property -> scope.getProperties(Name.guess(detail.name)).single() + DocumentationNodeKind.TypeParameter -> scope.getClassifier(Name.guess(detail.name)) + else -> scope.getClassifier(Name.guess(detail.name)) + } + + if (symbol == null) + throw IllegalStateException("Cannot resolve node $this detail $detail") + } return this }
\ No newline at end of file |