diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-10-20 12:53:17 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-10-20 12:53:17 +0200 |
commit | 8827d30048b9c50f47e62f69baf774363fdebc5d (patch) | |
tree | 9c683a39c053070f0907ff0e0ff1e68ae5b97518 /src | |
parent | 75834b6ae1a719be0298cefe7420ee3f9b7cd2a1 (diff) | |
download | dokka-8827d30048b9c50f47e62f69baf774363fdebc5d.tar.gz dokka-8827d30048b9c50f47e62f69baf774363fdebc5d.tar.bz2 dokka-8827d30048b9c50f47e62f69baf774363fdebc5d.zip |
update Dokka to Kotlin 1.0-beta
Diffstat (limited to 'src')
-rw-r--r-- | src/Analysis/AnalysisEnvironment.kt | 11 | ||||
-rw-r--r-- | src/Formats/StructuredFormatService.kt | 2 | ||||
-rw-r--r-- | src/Kotlin/ContentBuilder.kt | 12 | ||||
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 32 |
4 files changed, 29 insertions, 28 deletions
diff --git a/src/Analysis/AnalysisEnvironment.kt b/src/Analysis/AnalysisEnvironment.kt index 4937bb89..561ac2f0 100644 --- a/src/Analysis/AnalysisEnvironment.kt +++ b/src/Analysis/AnalysisEnvironment.kt @@ -36,8 +36,8 @@ import org.jetbrains.kotlin.idea.caches.resolve.KotlinOutOfBlockCompletionModifi import org.jetbrains.kotlin.idea.caches.resolve.LibraryModificationTracker import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.JetDeclaration -import org.jetbrains.kotlin.psi.JetElement +import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.CompilerEnvironment import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade @@ -91,6 +91,7 @@ public class AnalysisEnvironment(val messageCollector: MessageCollector, body: A override fun dependencies(): List<ModuleInfo> = listOf(this) } val resolverForProject = JvmAnalyzerFacade.setupResolverForProject( + "Dokka", projectContext, listOf(module), { ModuleContent(sourceFiles, GlobalSearchScope.allScope(environment.project)) }, @@ -166,11 +167,11 @@ class DokkaResolutionFacade(override val project: Project, override val moduleDescriptor: ModuleDescriptor, val resolverForModule: ResolverForModule) : ResolutionFacade { - override fun analyze(element: JetElement, bodyResolveMode: BodyResolveMode): BindingContext { + override fun analyze(element: KtElement, bodyResolveMode: BodyResolveMode): BindingContext { throw UnsupportedOperationException() } - override fun analyzeFullyAndGetResult(elements: Collection<JetElement>): AnalysisResult { + override fun analyzeFullyAndGetResult(elements: Collection<KtElement>): AnalysisResult { throw UnsupportedOperationException() } @@ -190,7 +191,7 @@ class DokkaResolutionFacade(override val project: Project, throw UnsupportedOperationException() } - override fun resolveToDescriptor(declaration: JetDeclaration): DeclarationDescriptor { + override fun resolveToDescriptor(declaration: KtDeclaration): DeclarationDescriptor { throw UnsupportedOperationException() } } diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index 41db84a3..98277c9c 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka -import java.util.LinkedHashMap import org.jetbrains.dokka.LanguageService.RenderMode +import java.util.* public data class FormatLink(val text: String, val href: String) diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index 95ff9f91..4dfcec3b 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -8,10 +8,10 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.idea.kdoc.getResolutionScope import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.JetBlockExpression -import org.jetbrains.kotlin.psi.JetDeclarationWithBody +import org.jetbrains.kotlin.psi.KtBlockExpression +import org.jetbrains.kotlin.psi.KtDeclarationWithBody import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils -import org.jetbrains.kotlin.resolve.scopes.JetScope +import org.jetbrains.kotlin.resolve.scopes.KtScope import org.jetbrains.kotlin.resolve.scopes.utils.asJetScope import java.util.* @@ -155,10 +155,10 @@ fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functio } val text = when (psiElement) { - is JetDeclarationWithBody -> ContentBlockCode().let() { + is KtDeclarationWithBody -> ContentBlockCode().let() { val bodyExpression = psiElement.bodyExpression when (bodyExpression) { - is JetBlockExpression -> bodyExpression.text.removeSurrounding("{", "}") + is KtBlockExpression -> bodyExpression.text.removeSurrounding("{", "}") else -> bodyExpression!!.text } } @@ -171,7 +171,7 @@ fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functio return ContentBlockCode("kotlin").let() { it.append(ContentText(finalText)); it } } -private fun DocumentationBuilder.resolveInScope(functionName: String, scope: JetScope): DeclarationDescriptor? { +private fun DocumentationBuilder.resolveInScope(functionName: String, scope: KtScope): DeclarationDescriptor? { var currentScope = scope val parts = functionName.split('.') diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index c45cb9e3..3f3eea67 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -14,11 +14,11 @@ import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection import org.jetbrains.kotlin.kdoc.psi.impl.KDocTag -import org.jetbrains.kotlin.lexer.JetSingleValueToken -import org.jetbrains.kotlin.lexer.JetTokens +import org.jetbrains.kotlin.lexer.KtSingleValueToken +import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.JetModifierListOwner -import org.jetbrains.kotlin.psi.JetParameter +import org.jetbrains.kotlin.psi.KtModifierListOwner +import org.jetbrains.kotlin.psi.KtParameter import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant import org.jetbrains.kotlin.resolve.constants.ConstantValue @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.lazy.ResolveSession import org.jetbrains.kotlin.resolve.source.PsiSourceElement import org.jetbrains.kotlin.resolve.source.getPsi import org.jetbrains.kotlin.types.ErrorUtils -import org.jetbrains.kotlin.types.JetType +import org.jetbrains.kotlin.types.KtType import org.jetbrains.kotlin.types.TypeProjection import org.jetbrains.kotlin.types.expressions.OperatorConventions @@ -55,9 +55,9 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, "kotlin.Unit", "kotlin.Byte", "kotlin.Short", "kotlin.Int", "kotlin.Long", "kotlin.Char", "kotlin.Boolean", "kotlin.Float", "kotlin.Double", "kotlin.String", "kotlin.Array", "kotlin.Any") val knownModifiers = setOf( - JetTokens.PUBLIC_KEYWORD, JetTokens.PROTECTED_KEYWORD, JetTokens.INTERNAL_KEYWORD, JetTokens.PRIVATE_KEYWORD, - JetTokens.OPEN_KEYWORD, JetTokens.FINAL_KEYWORD, JetTokens.ABSTRACT_KEYWORD, JetTokens.SEALED_KEYWORD, - JetTokens.OVERRIDE_KEYWORD) + KtTokens.PUBLIC_KEYWORD, KtTokens.PROTECTED_KEYWORD, KtTokens.INTERNAL_KEYWORD, KtTokens.PRIVATE_KEYWORD, + KtTokens.OPEN_KEYWORD, KtTokens.FINAL_KEYWORD, KtTokens.ABSTRACT_KEYWORD, KtTokens.SEALED_KEYWORD, + KtTokens.OVERRIDE_KEYWORD) fun parseDocumentation(descriptor: DeclarationDescriptor): Content { val kdoc = KDocFinder.findKDoc(descriptor) ?: findStdlibKDoc(descriptor) @@ -157,7 +157,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, return "(" + params.map { it.signature() }.join() + ")" } - fun JetType.signature(): String { + fun KtType.signature(): String { val declarationDescriptor = constructor.declarationDescriptor ?: return "<null>" val typeName = DescriptorUtils.getFqName(declarationDescriptor).asString() if (typeName == "Array" && arguments.size() == 1) { @@ -286,7 +286,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, } } - private fun ignoreSupertype(superType: JetType): Boolean { + private fun ignoreSupertype(superType: KtType): Boolean { val superClass = superType.constructor.declarationDescriptor as? ClassDescriptor if (superClass != null) { val fqName = DescriptorUtils.getFqNameSafe(superClass).asString() @@ -299,7 +299,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, appendType(projection.type, kind, projection.projectionKind.label) } - fun DocumentationNode.appendType(jetType: JetType?, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type, prefix: String = "") { + fun DocumentationNode.appendType(jetType: KtType?, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type, prefix: String = "") { if (jetType == null) return val classifierDescriptor = jetType.constructor.declarationDescriptor @@ -358,8 +358,8 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, } fun DocumentationNode.appendModifiers(descriptor: DeclarationDescriptor) { - val psi = (descriptor as DeclarationDescriptorWithSource).source.getPsi() as? JetModifierListOwner ?: return - JetTokens.MODIFIER_KEYWORDS_ARRAY.filter { it !in knownModifiers }.forEach { + val psi = (descriptor as DeclarationDescriptorWithSource).source.getPsi() as? KtModifierListOwner ?: return + KtTokens.MODIFIER_KEYWORDS_ARRAY.filter { it !in knownModifiers }.forEach { if (psi.hasModifier(it)) { appendTextNode(it.value, Kind.Modifier) } @@ -588,8 +588,8 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, } else null - if (token is JetSingleValueToken) { - return token.value + if (token is KtSingleValueToken) { + return token.getValue() } val name = name.asString() @@ -654,7 +654,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, val node = DocumentationNode(this, Kind.Parameter) node.appendType(varargElementType ?: type) if (declaresDefaultValue()) { - val psi = source.getPsi() as? JetParameter + val psi = source.getPsi() as? KtParameter if (psi != null) { val defaultValueText = psi.defaultValue?.text if (defaultValueText != null) { |