aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-03-17 19:54:11 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-03-17 19:54:11 +0100
commitc7916f74964246bee4d256c106b01c7e317e6c10 (patch)
tree39d28310f12ae4b8e3d4f182aa66b1e5b1c4319e /src
parent0406a6bce4f461f3ae846911505701324411fa9b (diff)
downloaddokka-c7916f74964246bee4d256c106b01c7e317e6c10.tar.gz
dokka-c7916f74964246bee4d256c106b01c7e317e6c10.tar.bz2
dokka-c7916f74964246bee4d256c106b01c7e317e6c10.zip
default objects -> companion objects
Diffstat (limited to 'src')
-rw-r--r--src/Formats/HtmlTemplateService.kt2
-rw-r--r--src/Formats/StructuredFormatService.kt12
-rw-r--r--src/Java/JavaDocumentationBuilder.kt4
-rw-r--r--src/Kotlin/DocumentationBuilder.kt18
-rw-r--r--src/Kotlin/KotlinLanguageService.kt8
-rw-r--r--src/Model/Content.kt4
-rw-r--r--src/Model/DocumentationNode.kt4
7 files changed, 26 insertions, 26 deletions
diff --git a/src/Formats/HtmlTemplateService.kt b/src/Formats/HtmlTemplateService.kt
index 859c37b7..246bd11e 100644
--- a/src/Formats/HtmlTemplateService.kt
+++ b/src/Formats/HtmlTemplateService.kt
@@ -4,7 +4,7 @@ public trait HtmlTemplateService {
fun appendHeader(to: StringBuilder, title: String?)
fun appendFooter(to: StringBuilder)
- default object {
+ companion object {
public fun default(css: String? = null): HtmlTemplateService {
return object : HtmlTemplateService {
override fun appendFooter(to: StringBuilder) {
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index 0e01db4d..a3803011 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -286,8 +286,8 @@ public abstract class StructuredFormatService(locationService: LocationService,
appendSection(location, "Constructors", node.members(DocumentationNode.Kind.Constructor), node, to)
appendSection(location, "Properties", node.members(DocumentationNode.Kind.Property), node, to)
appendSection(location, "Functions", node.members(DocumentationNode.Kind.Function), node, to)
- appendSection(location, "Default Object Properties", node.members(DocumentationNode.Kind.DefaultObjectProperty), node, to)
- appendSection(location, "Default Object Functions", node.members(DocumentationNode.Kind.DefaultObjectFunction), node, to)
+ appendSection(location, "Companion Object Properties", node.members(DocumentationNode.Kind.CompanionObjectProperty), node, to)
+ appendSection(location, "Companion Object Functions", node.members(DocumentationNode.Kind.CompanionObjectFunction), node, to)
appendSection(location, "Enum Values", node.members(DocumentationNode.Kind.EnumItem), node, to)
appendSection(location, "Other members", node.members.filter {
it.kind !in setOf(
@@ -300,16 +300,16 @@ public abstract class StructuredFormatService(locationService: LocationService,
DocumentationNode.Kind.Property,
DocumentationNode.Kind.Package,
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.DefaultObjectProperty,
- DocumentationNode.Kind.DefaultObjectFunction,
+ DocumentationNode.Kind.CompanionObjectProperty,
+ DocumentationNode.Kind.CompanionObjectFunction,
DocumentationNode.Kind.ExternalClass,
DocumentationNode.Kind.EnumItem
)
}, node, to)
appendSection(location, "Extension Properties", node.extensions.filter { it.kind == DocumentationNode.Kind.Property }, node, to)
appendSection(location, "Extension Functions", node.extensions.filter { it.kind == DocumentationNode.Kind.Function }, node, to)
- appendSection(location, "Default Object Extension Properties", node.extensions.filter { it.kind == DocumentationNode.Kind.DefaultObjectProperty }, node, to)
- appendSection(location, "Default Object Extension Functions", node.extensions.filter { it.kind == DocumentationNode.Kind.DefaultObjectFunction }, node, to)
+ appendSection(location, "Companion Object Extension Properties", node.extensions.filter { it.kind == DocumentationNode.Kind.CompanionObjectProperty }, node, to)
+ appendSection(location, "Companion Object Extension Functions", node.extensions.filter { it.kind == DocumentationNode.Kind.CompanionObjectFunction }, node, to)
appendSection(location, "Inheritors",
node.inheritors.filter { it.kind != DocumentationNode.Kind.EnumItem }, node, to)
appendSection(location, "Links", node.links, node, to)
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 00a7f3ac..7987a416 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -292,7 +292,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
private fun PsiField.nodeKind(): Kind = when {
this is PsiEnumConstant -> Kind.EnumItem
- hasModifierProperty(PsiModifier.STATIC) -> Kind.DefaultObjectProperty
+ hasModifierProperty(PsiModifier.STATIC) -> Kind.CompanionObjectProperty
else -> Kind.Property
}
@@ -311,7 +311,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
private fun PsiMethod.nodeKind(): Kind = when {
isConstructor() -> Kind.Constructor
- hasModifierProperty(PsiModifier.STATIC) -> Kind.DefaultObjectFunction
+ hasModifierProperty(PsiModifier.STATIC) -> Kind.CompanionObjectFunction
else -> Kind.Function
}
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index fba74b9b..0e0767d3 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -286,7 +286,7 @@ class DocumentationBuilder(val session: ResolveSession,
val classifierDescriptor = jetType.getConstructor().getDeclarationDescriptor()
val name = when (classifierDescriptor) {
is ClassDescriptor -> {
- if (classifierDescriptor.isDefaultObject()) {
+ if (classifierDescriptor.isCompanionObject()) {
classifierDescriptor.getContainingDeclaration().getName().asString() +
"." + classifierDescriptor.getName().asString()
}
@@ -436,9 +436,9 @@ class DocumentationBuilder(val session: ResolveSession,
getConstructors()
node.appendChildren(constructorsToDocument, DocumentationReference.Kind.Member)
}
- val members = getDefaultType().getMemberScope().getAllDescriptors().filter { it != getDefaultObjectDescriptor() }
+ val members = getDefaultType().getMemberScope().getAllDescriptors().filter { it != getCompanionObjectDescriptor() }
node.appendChildren(members, DocumentationReference.Kind.Member)
- val defaultObjectDescriptor = getDefaultObjectDescriptor()
+ val defaultObjectDescriptor = getCompanionObjectDescriptor()
if (defaultObjectDescriptor != null) {
node.appendChildren(defaultObjectDescriptor.getDefaultType().getMemberScope().getAllDescriptors(),
DocumentationReference.Kind.Member)
@@ -456,13 +456,13 @@ class DocumentationBuilder(val session: ResolveSession,
return node
}
- private fun CallableMemberDescriptor.inDefaultObject(): Boolean {
+ private fun CallableMemberDescriptor.inCompanionObject(): Boolean {
val containingDeclaration = getContainingDeclaration()
- if ((containingDeclaration as? ClassDescriptor)?.isDefaultObject() ?: false) {
+ if ((containingDeclaration as? ClassDescriptor)?.isCompanionObject() ?: false) {
return true
}
val receiver = getExtensionReceiverParameter()
- return (receiver?.getType()?.getConstructor()?.getDeclarationDescriptor() as? ClassDescriptor)?.isDefaultObject() ?: false
+ return (receiver?.getType()?.getConstructor()?.getDeclarationDescriptor() as? ClassDescriptor)?.isCompanionObject() ?: false
}
fun CallableMemberDescriptor.getExtensionClassDescriptor(): ClassifierDescriptor? {
@@ -475,7 +475,7 @@ class DocumentationBuilder(val session: ResolveSession,
}
fun FunctionDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, if (inDefaultObject()) Kind.DefaultObjectFunction else Kind.Function)
+ val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectFunction else Kind.Function)
node.appendInPageChildren(getTypeParameters(), DocumentationReference.Kind.Detail)
getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
@@ -557,7 +557,7 @@ class DocumentationBuilder(val session: ResolveSession,
}
fun PropertyDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, if (inDefaultObject()) Kind.DefaultObjectProperty else Kind.Property)
+ val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectProperty else Kind.Property)
node.appendInPageChildren(getTypeParameters(), DocumentationReference.Kind.Detail)
getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
node.appendType(getReturnType())
@@ -649,7 +649,7 @@ class DocumentationBuilder(val session: ResolveSession,
fun ReceiverParameterDescriptor.build(): DocumentationNode {
var receiverClass: DeclarationDescriptor = getType().getConstructor().getDeclarationDescriptor()
- if ((receiverClass as? ClassDescriptor)?.isDefaultObject() ?: false) {
+ if ((receiverClass as? ClassDescriptor)?.isCompanionObject() ?: false) {
receiverClass = receiverClass.getContainingDeclaration()!!
}
link(receiverClass,
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 855745e0..d046b650 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -28,9 +28,9 @@ class KotlinLanguageService : LanguageService {
DocumentationNode.Kind.Modifier -> renderModifier(node)
DocumentationNode.Kind.Constructor,
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.DefaultObjectFunction -> renderFunction(node, renderMode)
+ DocumentationNode.Kind.CompanionObjectFunction -> renderFunction(node, renderMode)
DocumentationNode.Kind.Property,
- DocumentationNode.Kind.DefaultObjectProperty -> renderProperty(node, renderMode)
+ DocumentationNode.Kind.CompanionObjectProperty -> renderProperty(node, renderMode)
else -> identifier(node.name)
}
}
@@ -248,7 +248,7 @@ class KotlinLanguageService : LanguageService {
when (node.kind) {
DocumentationNode.Kind.Constructor -> identifier(node.owner!!.name)
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.DefaultObjectFunction -> keyword("fun ")
+ DocumentationNode.Kind.CompanionObjectFunction -> keyword("fun ")
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
renderTypeParametersForNode(node)
@@ -285,7 +285,7 @@ class KotlinLanguageService : LanguageService {
renderAnnotationsForNode(node)
when (node.kind) {
DocumentationNode.Kind.Property,
- DocumentationNode.Kind.DefaultObjectProperty -> keyword("${node.getPropertyKeyword()} ")
+ DocumentationNode.Kind.CompanionObjectProperty -> keyword("${node.getPropertyKeyword()} ")
else -> throw IllegalArgumentException("Node $node is not a property")
}
renderTypeParametersForNode(node)
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index 176be8d3..0244359e 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -3,7 +3,7 @@ package org.jetbrains.dokka
import kotlin.properties.Delegates
public abstract class ContentNode {
- default object {
+ companion object {
val empty = ContentEmpty
}
}
@@ -126,7 +126,7 @@ public open class Content(): ContentBlock() {
fun findSectionByTag(tag: String): ContentSection? =
sections.firstOrNull { tag.equalsIgnoreCase(it.tag) }
- default object {
+ companion object {
val Empty = Content()
}
}
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index 663ca021..9e8a981f 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -78,8 +78,8 @@ public open class DocumentationNode(val name: String,
Function
Property
- DefaultObjectProperty
- DefaultObjectFunction
+ CompanionObjectProperty
+ CompanionObjectFunction
Parameter
Receiver