aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/DocumentationBuilder.kt14
-rw-r--r--src/Model/DocumentationModel.kt2
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