aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-10-09 18:50:54 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-10-09 18:50:54 +0300
commitc202931be1fc2a0e57ad1cb26931b80055b9df65 (patch)
tree239ef08090ee0f8979dca0448ea85e1817fdaebd /core/src/main/kotlin
parentaa3534c8e13f69ebb2700f24065cdb0c3f14b512 (diff)
downloaddokka-c202931be1fc2a0e57ad1cb26931b80055b9df65.tar.gz
dokka-c202931be1fc2a0e57ad1cb26931b80055b9df65.tar.bz2
dokka-c202931be1fc2a0e57ad1cb26931b80055b9df65.zip
Update kotlin-compiler to 1.1.51
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/Analysis/AnalysisEnvironment.kt32
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt7
2 files changed, 27 insertions, 12 deletions
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
index 1a6ccbd0..be4285c0 100644
--- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
@@ -12,15 +12,20 @@ import com.intellij.openapi.roots.OrderEnumerationHandler
import com.intellij.openapi.roots.ProjectFileIndex
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.util.Disposer
+import com.intellij.openapi.vfs.StandardFileSystems
+import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiElement
import com.intellij.psi.search.GlobalSearchScope
+import com.intellij.util.io.URLUtil
import org.jetbrains.kotlin.analyzer.*
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
+import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.cli.jvm.config.*
+import org.jetbrains.kotlin.cli.jvm.index.JavaRoot
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.container.getService
import org.jetbrains.kotlin.context.ProjectContext
@@ -35,10 +40,9 @@ import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.CompilerEnvironment
-import org.jetbrains.kotlin.resolve.MultiTargetPlatform
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
-import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM
+import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
import java.io.File
@@ -109,7 +113,14 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
val builtIns = JvmBuiltIns(projectContext.storageManager)
- val resolverForProject = AnalyzerFacade.setupResolverForProject(
+
+ val javaRoots = run {
+ val jvfs = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JAR_PROTOCOL)
+
+ classpath.map { JavaRoot(jvfs.findFileByPath("${it.absolutePath}${URLUtil.JAR_SEPARATOR}")!!, JavaRoot.RootType.BINARY) }
+ }
+
+ val resolverForProject = ResolverForProjectImpl(
"Dokka",
projectContext,
listOf(library, module),
@@ -129,12 +140,13 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
library
},
CompilerEnvironment,
- packagePartProviderFactory = {
- info, content ->
- JvmPackagePartProvider(environment, content.moduleContentScope)
+ packagePartProviderFactory = { info, content ->
+ JvmPackagePartProvider(LanguageVersionSettingsImpl.DEFAULT, content.moduleContentScope).apply {
+ addRoots(javaRoots)
+ }
},
- builtIns = { builtIns },
- modulePlatforms = { MultiTargetPlatform.Specific("JVM") }
+ builtIns = builtIns,
+ modulePlatforms = { JvmPlatform.multiTargetPlatform }
)
resolverForProject.resolverForModule(library) // Required before module to initialize library properly
@@ -209,6 +221,10 @@ fun contentRootFromPath(path: String): ContentRoot {
class DokkaResolutionFacade(override val project: Project,
override val moduleDescriptor: ModuleDescriptor,
val resolverForModule: ResolverForModule) : ResolutionFacade {
+ override fun <T : Any> tryGetFrontendService(element: PsiElement, serviceClass: Class<T>): T? {
+ return null
+ }
+
override fun resolveToDescriptor(declaration: KtDeclaration, bodyResolveMode: BodyResolveMode): DeclarationDescriptor {
return resolveSession.resolveToDescriptor(declaration)
}
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 707831ae..fddf0814 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -755,11 +755,10 @@ class DocumentationBuilder
return null
}
val node = DocumentationNode(annotationClass.name.asString(), Content.Empty, NodeKind.Annotation)
- val arguments = allValueArguments.toList().sortedBy { it.first.index }
- arguments.forEach {
- val valueNode = it.second.toDocumentationNode()
+ allValueArguments.forEach { (name, value) ->
+ val valueNode = value.toDocumentationNode()
if (valueNode != null) {
- val paramNode = DocumentationNode(it.first.name.asString(), Content.Empty, NodeKind.Parameter)
+ val paramNode = DocumentationNode(name.asString(), Content.Empty, NodeKind.Parameter)
paramNode.append(valueNode, RefKind.Detail)
node.append(paramNode, RefKind.Detail)
}