diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 22:25:01 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 22:25:01 +0400 |
commit | 09935fc1657670eaa8beb1b56718ed267404d7db (patch) | |
tree | d43ad32d8a29fa0e0d73de641b4f459463b16e30 /src | |
parent | b511259a37aa9feee06a3ca92b7967552aa34104 (diff) | |
download | dokka-09935fc1657670eaa8beb1b56718ed267404d7db.tar.gz dokka-09935fc1657670eaa8beb1b56718ed267404d7db.tar.bz2 dokka-09935fc1657670eaa8beb1b56718ed267404d7db.zip |
Support type parameter constraints as type parameter details.
Diffstat (limited to 'src')
-rw-r--r-- | src/Model/DocumentationBuilder.kt | 14 | ||||
-rw-r--r-- | src/Model/DocumentationModel.kt | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/Model/DocumentationBuilder.kt b/src/Model/DocumentationBuilder.kt index 2afe366b..73f83ff9 100644 --- a/src/Model/DocumentationBuilder.kt +++ b/src/Model/DocumentationBuilder.kt @@ -4,6 +4,7 @@ import org.jetbrains.jet.lang.resolve.* import org.jetbrains.jet.lang.psi.* import org.jetbrains.jet.lang.descriptors.* import org.jetbrains.jet.lang.descriptors.impl.* +import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns fun BindingContext.createSourceModel(file: JetFile): DocumentationModel { val model = DocumentationModel() @@ -55,6 +56,19 @@ class DocumentationBuilderVisitor(val context: BindingContext) : DeclarationDesc val doc = context.getDocumentation(descriptor!!) val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.TypeParameter) data?.addReferenceTo(node, DocumentationReferenceKind.Detail) + val builtIns = KotlinBuiltIns.getInstance() + for (constraint in descriptor.getUpperBounds()) { + if (constraint == builtIns.getDefaultBound()) + continue + val constraintNode = DocumentationNode(constraint.toString(), "", DocumentationNodeKind.UpperBound) + node.addReferenceTo(constraintNode, DocumentationReferenceKind.Detail) + } + for (constraint in descriptor.getLowerBounds()) { + if (builtIns.isNothing(constraint)) + continue + val constraintNode = DocumentationNode(constraint.toString(), "", DocumentationNodeKind.LowerBound) + node.addReferenceTo(constraintNode, DocumentationReferenceKind.Detail) + } return node } diff --git a/src/Model/DocumentationModel.kt b/src/Model/DocumentationModel.kt index 0113eb18..7f40acb2 100644 --- a/src/Model/DocumentationModel.kt +++ b/src/Model/DocumentationModel.kt @@ -14,6 +14,8 @@ public enum class DocumentationNodeKind { Property Parameter TypeParameter + UpperBound + LowerBound Exception Page |