aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Diagnostics.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-12 04:23:51 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-12 04:23:51 +0400
commita6000809a34735ffe1c40bf07a9e291d3c767eb9 (patch)
tree9d32fe971859e8cd36cb302be204fcdccefe886d /src/Model/Diagnostics.kt
parenta83488aae453f1bf01cfb5507317acf0b9ddfb82 (diff)
downloaddokka-a6000809a34735ffe1c40bf07a9e291d3c767eb9.tar.gz
dokka-a6000809a34735ffe1c40bf07a9e291d3c767eb9.tar.bz2
dokka-a6000809a34735ffe1c40bf07a9e291d3c767eb9.zip
Store descriptors instead of resolution scopes, rename Model -> Module
Diffstat (limited to 'src/Model/Diagnostics.kt')
-rw-r--r--src/Model/Diagnostics.kt39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Model/Diagnostics.kt b/src/Model/Diagnostics.kt
index 78d711a0..723bd59d 100644
--- a/src/Model/Diagnostics.kt
+++ b/src/Model/Diagnostics.kt
@@ -2,32 +2,31 @@ package org.jetbrains.dokka
import org.jetbrains.jet.lang.descriptors.*
import org.jetbrains.jet.lang.resolve.name.*
+import org.jetbrains.jet.lang.resolve.BindingContext
-fun DocumentationNode.checkResolve() {
- val parentScope = scope
+fun BindingContext.checkResolveChildren(node : DocumentationNode) {
+ if (node.kind != DocumentationNodeKind.Module && node.kind != DocumentationNodeKind.Package) {
+ // TODO: we don't resolve packages and modules for now
- for (item in details + members) {
- val symbolName = item.name
- val symbol: DeclarationDescriptor? = when (item.kind) {
- 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()
+ val parentScope = getResolutionScope(node.descriptor)
+ for (item in node.details + node.members) {
+ val symbolName = item.name
+ val symbol: DeclarationDescriptor? = when (item.kind) {
+ 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()
+ else -> parentScope.getClassifier(Name.guess(symbolName))
}
- else -> parentScope.getClassifier(Name.guess(symbolName))
- }
- if (symbol == null)
- println("WARNING: Cannot resolve $item in ${path(this)}")
+ if (symbol == null)
+ println("WARNING: Cannot resolve $item in ${path(node)}")
+ }
}
- for (reference in allReferences().filterNot { it.kind == DocumentationReferenceKind.Owner }) {
- reference.to.checkResolve()
+ for (reference in node.allReferences().filterNot { it.kind == DocumentationReferenceKind.Owner }) {
+ checkResolveChildren(reference.to)
}
}