aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/analysis/AnalysisEnvironment.kt34
1 files changed, 15 insertions, 19 deletions
diff --git a/core/src/main/kotlin/analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/analysis/AnalysisEnvironment.kt
index 7ed55acf..fea3516c 100644
--- a/core/src/main/kotlin/analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/analysis/AnalysisEnvironment.kt
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
-import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
+import org.jetbrains.kotlin.caches.resolve.JsResolverForModuleFactory
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.config.ContentRoot
import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
@@ -46,13 +46,9 @@ import org.jetbrains.kotlin.context.withModule
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
-import org.jetbrains.kotlin.ide.konan.NativeLibraryInfo
import org.jetbrains.kotlin.ide.konan.analyzer.NativeResolverForModuleFactory
-import org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeLoadingMetadataCache
-import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices
-import org.jetbrains.kotlin.js.resolve.JsResolverForModuleFactory
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
import org.jetbrains.kotlin.name.Name
@@ -61,7 +57,6 @@ import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.js.JsPlatforms
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.unspecifiedJvmPlatform
-import org.jetbrains.kotlin.platform.konan.KonanPlatforms
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingTrace
@@ -72,11 +67,17 @@ import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
import org.jetbrains.kotlin.resolve.jvm.JvmResolverForModuleFactory
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
-import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
+import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
+import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
+import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
+import org.jetbrains.kotlin.descriptors.konan.KlibModuleOrigin
+import org.jetbrains.kotlin.ide.konan.NativeKlibLibraryInfo
+import org.jetbrains.kotlin.load.java.structure.impl.classFiles.BinaryJavaClass
+import org.jetbrains.kotlin.platform.konan.NativePlatforms
import java.io.File
const val JAR_SEPARATOR = "!/"
@@ -123,7 +124,6 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
ModuleManager::class.java, moduleManager
)
- Extensions.registerAreaClass("IDEA_MODULE", null)
CoreApplicationEnvironment.registerExtensionPoint(
Extensions.getRootArea(),
OrderEnumerationHandler.EP_NAME, OrderEnumerationHandler.Factory::class.java
@@ -159,7 +159,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
val targetPlatform = when (analysisPlatform) {
Platform.js -> JsPlatforms.defaultJsPlatform
Platform.common -> CommonPlatforms.defaultCommonPlatform
- Platform.native -> KonanPlatforms.defaultKonanPlatform
+ Platform.native -> NativePlatforms.unspecifiedNativePlatform
Platform.jvm -> JvmPlatforms.defaultJvmPlatform
}
@@ -246,16 +246,16 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
}
private fun createNativeLibraryModuleInfo(libraryFile: File): LibraryModuleInfo {
- val kotlinLibrary = createKotlinLibrary(org.jetbrains.kotlin.konan.file.File(libraryFile.absolutePath), false)
+ val kotlinLibrary = createKotlinLibrary(org.jetbrains.kotlin.konan.file.File(libraryFile.absolutePath), "",false)
return object : LibraryModuleInfo {
override val analyzerServices: PlatformDependentAnalyzerServices =
analysisPlatform.analyzerServices()
override val name: Name = Name.special("<klib>")
- override val platform: TargetPlatform = KonanPlatforms.defaultKonanPlatform
+ override val platform: TargetPlatform = NativePlatforms.unspecifiedNativePlatform
override fun dependencies(): List<ModuleInfo> = listOf(this)
override fun getLibraryRoots(): Collection<String> = listOf(libraryFile.absolutePath)
override val capabilities: Map<ModuleDescriptor.Capability<*>, Any?>
- get() = super.capabilities + (NativeLibraryInfo.NATIVE_LIBRARY_CAPABILITY to kotlinLibrary)
+ get() = super.capabilities + (KlibModuleOrigin.CAPABILITY to kotlinLibrary)
}
}
@@ -345,15 +345,11 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
descriptor: ModuleDescriptor,
moduleInfo: ModuleInfo
): ResolverForModule {
- (ApplicationManager.getApplication() as MockApplication).addComponent(
- KotlinNativeLoadingMetadataCache::class.java,
- KotlinNativeLoadingMetadataCache()
- )
return NativeResolverForModuleFactory(
PlatformAnalysisParameters.Empty,
CompilerEnvironment,
- KonanPlatforms.defaultKonanPlatform
+ NativePlatforms.unspecifiedNativePlatform
).createResolverForModule(
descriptor as ModuleDescriptorImpl,
projectContext.withModule(descriptor),
@@ -413,14 +409,14 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
addRoots(javaRoots, messageCollector)
}
}, {
- val file = (it as JavaClassImpl).psi.containingFile.virtualFile
+ val file = (it as? BinaryJavaClass)?.virtualFile ?: (it as JavaClassImpl).psi.containingFile.virtualFile
if (file in sourcesScope)
module
else
library
}),
CompilerEnvironment,
- KonanPlatforms.defaultKonanPlatform
+ unspecifiedJvmPlatform
).createResolverForModule(
descriptor as ModuleDescriptorImpl,
projectContext.withModule(descriptor),