Rename "Konan" -> "KotlinNative" in class and function names (part 3)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
cb7009ace8
commit
f663c0ea87
+1
-1
@@ -3,7 +3,7 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.gradle.internal;
|
||||
package org.jetbrains.kotlin.ide.konan.gradle;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionEP;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
+4
-3
@@ -3,7 +3,7 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan
|
||||
package org.jetbrains.kotlin.ide.konan
|
||||
|
||||
import com.intellij.ide.highlighter.ArchiveFileType
|
||||
import com.intellij.ide.util.TipAndTrickBean
|
||||
@@ -12,8 +12,9 @@ import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager
|
||||
import org.jetbrains.kotlin.konan.library.KLIB_FILE_EXTENSION
|
||||
|
||||
class KonanApplicationComponent : ApplicationComponent {
|
||||
override fun getComponentName(): String = "KonanApplicationComponent"
|
||||
class KotlinNativeApplicationComponent : ApplicationComponent {
|
||||
|
||||
override fun getComponentName(): String = "KotlinNativeApplicationComponent"
|
||||
|
||||
override fun initComponent() {
|
||||
FileTypeManager.getInstance().associateExtension(ArchiveFileType.INSTANCE, KLIB_FILE_EXTENSION)
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform
|
||||
import org.jetbrains.kotlin.serialization.konan.KonanResolvedModuleDescriptors
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
const val KONAN_CURRENT_ABI_VERSION = 1
|
||||
const val KOTLIN_NATIVE_CURRENT_ABI_VERSION = 1
|
||||
|
||||
fun createFileStub(project: Project, text: String): PsiFileStub<*> {
|
||||
val virtualFile = LightVirtualFile("dummy.kt", KotlinFileType.INSTANCE, text)
|
||||
@@ -41,13 +41,12 @@ fun createFileStub(project: Project, text: String): PsiFileStub<*> {
|
||||
fun createLoggingErrorReporter(log: Logger) = LoggingErrorReporter(log)
|
||||
|
||||
fun ModuleInfo.createResolvedModuleDescriptors(
|
||||
project: Project,
|
||||
storageManager: StorageManager,
|
||||
builtIns: KotlinBuiltIns,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): KonanResolvedModuleDescriptors {
|
||||
|
||||
// This is to preserve "capabilities" from the original IntelliJ LibraryInfo:
|
||||
// This is to preserve "capabilities" from the original IDEA LibraryInfo:
|
||||
val libraryMap =
|
||||
this.dependencies().filterIsInstance<LibraryInfo>().flatMap { dependency ->
|
||||
if (dependency.platform == KonanPlatform) {
|
||||
@@ -62,7 +61,7 @@ fun ModuleInfo.createResolvedModuleDescriptors(
|
||||
val libraryPaths = libraryMap.keys.toList()
|
||||
|
||||
val resolvedLibraries = KotlinNativePluginSearchPathResolver(libraryPaths)
|
||||
.libraryResolver(KONAN_CURRENT_ABI_VERSION)
|
||||
.libraryResolver(KOTLIN_NATIVE_CURRENT_ABI_VERSION)
|
||||
.resolveWithDependencies(libraryPaths)
|
||||
|
||||
return DefaultResolvedDescriptorsFactory.createResolved(
|
||||
@@ -71,6 +70,6 @@ fun ModuleInfo.createResolvedModuleDescriptors(
|
||||
builtIns,
|
||||
languageVersionSettings,
|
||||
null
|
||||
// This is to preserve "capabilities" from the original IntelliJ LibraryInfo:
|
||||
) { konanLibrary -> libraryMap[konanLibrary.libraryFile.path]?.capabilities ?: emptyMap() }
|
||||
// This is to preserve "capabilities" from the original IDEA LibraryInfo:
|
||||
) { library -> libraryMap[library.libraryFile.path]?.capabilities ?: emptyMap() }
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ private fun createKotlinNativeBuiltIns(projectContext: ProjectContext): KotlinBu
|
||||
if (stdlib != null) {
|
||||
|
||||
val (path, libraryInfo) = stdlib
|
||||
val library = createKonanLibrary(File(path), KONAN_CURRENT_ABI_VERSION)
|
||||
val library = createKonanLibrary(File(path), KOTLIN_NATIVE_CURRENT_ABI_VERSION)
|
||||
|
||||
val builtInsModule = DefaultDeserializedDescriptorFactory.createDescriptorAndNewBuiltIns(
|
||||
library,
|
||||
|
||||
@@ -58,7 +58,6 @@ object NativeAnalyzerFacade : ResolverForModuleFactory() {
|
||||
)
|
||||
|
||||
val moduleDescriptors = moduleContent.moduleInfo.createResolvedModuleDescriptors(
|
||||
moduleContext.project,
|
||||
moduleContext.storageManager,
|
||||
moduleContext.module.builtIns,
|
||||
languageVersionSettings
|
||||
|
||||
+2
-2
@@ -3,12 +3,12 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider
|
||||
import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
|
||||
|
||||
class KonanDecompiledFile(provider: KotlinDecompiledFileViewProvider, text: (VirtualFile) -> DecompiledText) :
|
||||
class KotlinNativeDecompiledFile(provider: KotlinDecompiledFileViewProvider, text: (VirtualFile) -> DecompiledText) :
|
||||
KtDecompiledFile(provider, text)
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.analyser.index
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.ApplicationComponent
|
||||
@@ -12,12 +12,12 @@ import com.intellij.util.containers.ContainerUtil.createConcurrentWeakValueMap
|
||||
import org.jetbrains.kotlin.metadata.konan.KonanProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.konan.parsePackageFragment
|
||||
|
||||
class KonanDescriptorManager : ApplicationComponent {
|
||||
class KotlinNativeDescriptorManager : ApplicationComponent {
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(): KonanDescriptorManager = ApplicationManager.getApplication().getComponent(KonanDescriptorManager::class.java)
|
||||
fun getInstance(): KotlinNativeDescriptorManager =
|
||||
ApplicationManager.getApplication().getComponent(KotlinNativeDescriptorManager::class.java)
|
||||
}
|
||||
|
||||
private val protoCache = createConcurrentWeakValueMap<VirtualFile, KonanProtoBuf.LinkDataPackageFragment>()
|
||||
+4
-4
@@ -3,12 +3,12 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.analyser.index;
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler;
|
||||
|
||||
import org.jetbrains.kotlin.idea.util.KotlinBinaryExtension;
|
||||
|
||||
public class KonanMetaBinary extends KotlinBinaryExtension {
|
||||
public KonanMetaBinary() {
|
||||
super(KonanMetaFileType.INSTANCE);
|
||||
public class KotlinNativeMetaBinary extends KotlinBinaryExtension {
|
||||
public KotlinNativeMetaBinary() {
|
||||
super(KotlinNativeMetaFileType.INSTANCE);
|
||||
}
|
||||
}
|
||||
+13
-11
@@ -3,7 +3,7 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.analyser.index
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType
|
||||
import com.intellij.openapi.fileTypes.FileTypeConsumer
|
||||
@@ -15,30 +15,32 @@ import org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform
|
||||
import org.jetbrains.kotlin.serialization.konan.KonanSerializerProtocol
|
||||
import org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer
|
||||
|
||||
class KonanMetadataDecompiler : KonanMetadataDecompilerBase<KonanMetadataVersion>(
|
||||
KonanMetaFileType, KonanPlatform, KonanSerializerProtocol, NullFlexibleTypeDeserializer,
|
||||
KonanMetadataVersion.DEFAULT_INSTANCE, KonanMetadataVersion.INVALID_VERSION, KonanMetaFileType.STUB_VERSION
|
||||
class KotlinNativeMetadataDecompiler : KotlinNativeMetadataDecompilerBase<KotlinNativeMetadataVersion>(
|
||||
KotlinNativeMetaFileType, KonanPlatform, KonanSerializerProtocol, NullFlexibleTypeDeserializer,
|
||||
KotlinNativeMetadataVersion.DEFAULT_INSTANCE,
|
||||
KotlinNativeMetadataVersion.INVALID_VERSION,
|
||||
KotlinNativeMetaFileType.STUB_VERSION
|
||||
) {
|
||||
|
||||
override fun doReadFile(file: VirtualFile): FileWithMetadata? {
|
||||
val proto = KonanDescriptorManager.getInstance().getCachedPackageFragment(file)
|
||||
val proto = KotlinNativeDescriptorManager.getInstance().getCachedPackageFragment(file)
|
||||
return FileWithMetadata.Compatible(proto, KonanSerializerProtocol) //todo: check version compatibility
|
||||
}
|
||||
}
|
||||
|
||||
class KonanMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
|
||||
class KotlinNativeMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
|
||||
override fun isCompatible(): Boolean = true //todo: ?
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val DEFAULT_INSTANCE = KonanMetadataVersion(1, 1, 0)
|
||||
val DEFAULT_INSTANCE = KotlinNativeMetadataVersion(1, 1, 0)
|
||||
|
||||
@JvmField
|
||||
val INVALID_VERSION = KonanMetadataVersion()
|
||||
val INVALID_VERSION = KotlinNativeMetadataVersion()
|
||||
}
|
||||
}
|
||||
|
||||
object KonanMetaFileType : FileType {
|
||||
object KotlinNativeMetaFileType : FileType {
|
||||
override fun getName() = "KNM"
|
||||
override fun getDescription() = "Kotlin/Native Metadata"
|
||||
override fun getDefaultExtension() = KLIB_METADATA_FILE_EXTENSION
|
||||
@@ -50,7 +52,7 @@ object KonanMetaFileType : FileType {
|
||||
const val STUB_VERSION = 2
|
||||
}
|
||||
|
||||
class KonanMetaFileTypeFactory : FileTypeFactory() {
|
||||
class KotlinNativeMetaFileTypeFactory : FileTypeFactory() {
|
||||
|
||||
override fun createFileTypes(consumer: FileTypeConsumer) = consumer.consume(KonanMetaFileType, KonanMetaFileType.defaultExtension)
|
||||
override fun createFileTypes(consumer: FileTypeConsumer) = consumer.consume(KotlinNativeMetaFileType, KotlinNativeMetaFileType.defaultExtension)
|
||||
}
|
||||
+24
-9
@@ -3,13 +3,12 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.analyser.index
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers
|
||||
import org.jetbrains.konan.KonanDecompiledFile
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider
|
||||
import org.jetbrains.kotlin.idea.decompiler.common.createIncompatibleAbiVersionDecompiledText
|
||||
@@ -30,8 +29,7 @@ import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.io.IOException
|
||||
|
||||
//todo: Fix in Kotlin plugin
|
||||
abstract class KonanMetadataDecompilerBase<out V : BinaryVersion>(
|
||||
abstract class KotlinNativeMetadataDecompilerBase<out V : BinaryVersion>(
|
||||
private val fileType: FileType,
|
||||
private val targetPlatform: TargetPlatform,
|
||||
private val serializerProtocol: SerializerExtensionProtocol,
|
||||
@@ -41,7 +39,13 @@ abstract class KonanMetadataDecompilerBase<out V : BinaryVersion>(
|
||||
stubVersion: Int
|
||||
) : ClassFileDecompilers.Full() {
|
||||
|
||||
private val stubBuilder = KonanMetadataStubBuilder(stubVersion, fileType, serializerProtocol, ::readFileSafely)
|
||||
private val stubBuilder =
|
||||
KotlinNativeMetadataStubBuilder(
|
||||
stubVersion,
|
||||
fileType,
|
||||
serializerProtocol,
|
||||
::readFileSafely
|
||||
)
|
||||
|
||||
private val renderer = DescriptorRenderer.withOptions { defaultDecompilerRendererOptions() }
|
||||
|
||||
@@ -52,7 +56,12 @@ abstract class KonanMetadataDecompilerBase<out V : BinaryVersion>(
|
||||
override fun getStubBuilder() = stubBuilder
|
||||
|
||||
override fun createFileViewProvider(file: VirtualFile, manager: PsiManager, physical: Boolean) =
|
||||
KotlinDecompiledFileViewProvider(manager, file, physical) { provider -> KonanDecompiledFile(provider, ::buildDecompiledText) }
|
||||
KotlinDecompiledFileViewProvider(manager, file, physical) { provider ->
|
||||
KotlinNativeDecompiledFile(
|
||||
provider,
|
||||
::buildDecompiledText
|
||||
)
|
||||
}
|
||||
|
||||
private fun readFileSafely(file: VirtualFile): FileWithMetadata? {
|
||||
if (!file.isValid) return null
|
||||
@@ -75,7 +84,13 @@ abstract class KonanMetadataDecompilerBase<out V : BinaryVersion>(
|
||||
|
||||
return when (file) {
|
||||
is FileWithMetadata.Incompatible -> createIncompatibleAbiVersionDecompiledText(expectedBinaryVersion, file.version)
|
||||
is FileWithMetadata.Compatible -> decompiledText(file, targetPlatform, serializerProtocol, flexibleTypeDeserializer, renderer)
|
||||
is FileWithMetadata.Compatible -> decompiledText(
|
||||
file,
|
||||
targetPlatform,
|
||||
serializerProtocol,
|
||||
flexibleTypeDeserializer,
|
||||
renderer
|
||||
)
|
||||
null -> createIncompatibleAbiVersionDecompiledText(expectedBinaryVersion, invalidBinaryVersion)
|
||||
}
|
||||
}
|
||||
@@ -99,7 +114,7 @@ sealed class FileWithMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
//todo: this function is extracted for KonanMetadataStubBuilder, that's the difference from Big Kotlin.
|
||||
//todo: this function is extracted for KotlinNativeMetadataStubBuilder, that's the difference from Big Kotlin.
|
||||
fun decompiledText(
|
||||
file: FileWithMetadata.Compatible, targetPlatform: TargetPlatform,
|
||||
serializerProtocol: SerializerExtensionProtocol,
|
||||
@@ -107,7 +122,7 @@ fun decompiledText(
|
||||
renderer: DescriptorRenderer
|
||||
): DecompiledText {
|
||||
val packageFqName = file.packageFqName
|
||||
val resolver = KonanMetadataDeserializerForDecompiler(
|
||||
val resolver = KotlinNativeMetadataDeserializerForDecompiler(
|
||||
packageFqName, file.proto, file.nameResolver,
|
||||
targetPlatform, serializerProtocol, flexibleTypeDeserializer
|
||||
)
|
||||
+6
-6
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
package org.jetbrains.konan.analyser.index
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
||||
@@ -23,8 +23,7 @@ import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
|
||||
import org.jetbrains.kotlin.serialization.deserialization.*
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
||||
|
||||
//todo: Fix in Kotlin plugin
|
||||
class KonanMetadataDeserializerForDecompiler(
|
||||
class KotlinNativeMetadataDeserializerForDecompiler(
|
||||
packageFqName: FqName,
|
||||
private val proto: KonanProtoBuf.LinkDataPackageFragment,
|
||||
private val nameResolver: NameResolver,
|
||||
@@ -40,7 +39,8 @@ class KonanMetadataDeserializerForDecompiler(
|
||||
val notFoundClasses = NotFoundClasses(storageManager, moduleDescriptor)
|
||||
|
||||
deserializationComponents = DeserializationComponents(
|
||||
storageManager, moduleDescriptor, DeserializationConfiguration.Default, KonanProtoBasedClassDataFinder(proto, nameResolver),
|
||||
storageManager, moduleDescriptor, DeserializationConfiguration.Default,
|
||||
KotlinNativeProtoBasedClassDataFinder(proto, nameResolver),
|
||||
AnnotationAndConstantLoaderImpl(moduleDescriptor, notFoundClasses, serializerProtocol), packageFragmentProvider,
|
||||
ResolveEverythingToKotlinAnyLocalClassifierResolver(builtIns), createLoggingErrorReporter(LOG),
|
||||
LookupTracker.DO_NOTHING, flexibleTypeDeserializer, emptyList(), notFoundClasses, ContractDeserializer.DEFAULT,
|
||||
@@ -57,7 +57,7 @@ class KonanMetadataDeserializerForDecompiler(
|
||||
createDummyPackageFragment(facadeFqName),
|
||||
proto.`package`,
|
||||
nameResolver,
|
||||
KonanMetadataVersion.DEFAULT_INSTANCE,
|
||||
KotlinNativeMetadataVersion.DEFAULT_INSTANCE,
|
||||
containerSource = null,
|
||||
components = deserializationComponents
|
||||
) { emptyList() }
|
||||
@@ -66,7 +66,7 @@ class KonanMetadataDeserializerForDecompiler(
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance(KonanMetadataDeserializerForDecompiler::class.java)
|
||||
private val LOG = Logger.getInstance(KotlinNativeMetadataDeserializerForDecompiler::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -3,7 +3,7 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.analyser.index
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
@@ -12,6 +12,8 @@ import com.intellij.psi.impl.compiled.ClassFileStubBuilder
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import com.intellij.util.indexing.FileContent
|
||||
import org.jetbrains.kotlin.ide.konan.createFileStub
|
||||
import org.jetbrains.kotlin.ide.konan.decompiler.FileWithMetadata
|
||||
import org.jetbrains.kotlin.ide.konan.decompiler.decompiledText
|
||||
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.createIncompatibleAbiVersionFileStub
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.defaultDecompilerRendererOptions
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
@@ -19,8 +21,7 @@ import org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform
|
||||
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
|
||||
import org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer
|
||||
|
||||
//todo: Fix in Kotlin plugin
|
||||
open class KonanMetadataStubBuilder(
|
||||
open class KotlinNativeMetadataStubBuilder(
|
||||
private val version: Int,
|
||||
private val fileType: FileType,
|
||||
private val serializerProtocol: SerializerExtensionProtocol,
|
||||
@@ -39,7 +40,13 @@ open class KonanMetadataStubBuilder(
|
||||
is FileWithMetadata.Incompatible -> createIncompatibleAbiVersionFileStub()
|
||||
is FileWithMetadata.Compatible -> { //todo: this part is implemented in our own way
|
||||
val renderer = DescriptorRenderer.withOptions { defaultDecompilerRendererOptions() }
|
||||
val ktFileText = decompiledText(file, KonanPlatform, serializerProtocol, NullFlexibleTypeDeserializer, renderer)
|
||||
val ktFileText = decompiledText(
|
||||
file,
|
||||
KonanPlatform,
|
||||
serializerProtocol,
|
||||
NullFlexibleTypeDeserializer,
|
||||
renderer
|
||||
)
|
||||
createFileStub(content.project, ktFileText.text)
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -3,7 +3,7 @@
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.konan.analyser.index
|
||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||
@@ -13,8 +13,7 @@ import org.jetbrains.kotlin.serialization.deserialization.ClassData
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ClassDataFinder
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
||||
|
||||
//todo: Fix in Kotlin plugin
|
||||
class KonanProtoBasedClassDataFinder(
|
||||
class KotlinNativeProtoBasedClassDataFinder(
|
||||
proto: KonanProtoBuf.LinkDataPackageFragment,
|
||||
private val nameResolver: NameResolver,
|
||||
private val classSource: (ClassId) -> SourceElement = { SourceElement.NO_SOURCE }
|
||||
@@ -28,6 +27,6 @@ class KonanProtoBasedClassDataFinder(
|
||||
|
||||
override fun findClassData(classId: ClassId): ClassData? {
|
||||
val classProto = classIdToProto[classId] ?: return null
|
||||
return ClassData(nameResolver, classProto, KonanMetadataVersion.DEFAULT_INSTANCE, classSource(classId))
|
||||
return ClassData(nameResolver, classProto, KotlinNativeMetadataVersion.DEFAULT_INSTANCE, classSource(classId))
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -6,8 +6,8 @@
|
||||
package org.jetbrains.kotlin.ide.konan.index
|
||||
|
||||
import com.intellij.util.indexing.FileBasedIndex
|
||||
import org.jetbrains.konan.analyser.index.KonanDescriptorManager
|
||||
import org.jetbrains.konan.analyser.index.KonanMetaFileType
|
||||
import org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeDescriptorManager
|
||||
import org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeMetaFileType
|
||||
import org.jetbrains.kotlin.idea.vfilefinder.KotlinFileIndexBase
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
@@ -15,18 +15,18 @@ object KotlinNativeMetaFileIndex : KotlinFileIndexBase<KotlinNativeMetaFileIndex
|
||||
|
||||
override fun getIndexer() = INDEXER
|
||||
|
||||
override fun getInputFilter() = FileBasedIndex.InputFilter { it.fileType === KonanMetaFileType }
|
||||
override fun getInputFilter() = FileBasedIndex.InputFilter { it.fileType === KotlinNativeMetaFileType }
|
||||
|
||||
override fun getVersion() = VERSION
|
||||
|
||||
// this is to express intention to index all Kotlin/Native metadata files irrespectively to file size
|
||||
override fun getFileTypesWithSizeLimitNotApplicable() = listOf(KonanMetaFileType)
|
||||
// This is to express intention to index all Kotlin/Native metadata files irrespectively to file size:
|
||||
override fun getFileTypesWithSizeLimitNotApplicable() = listOf(KotlinNativeMetaFileType)
|
||||
|
||||
private const val VERSION = 4
|
||||
|
||||
/*todo: check version?!*/
|
||||
private val INDEXER = indexer { fileContent ->
|
||||
val fragment = KonanDescriptorManager.getInstance().getCachedPackageFragment(fileContent.file)
|
||||
val fragment = KotlinNativeDescriptorManager.getInstance().getCachedPackageFragment(fileContent.file)
|
||||
FqName(fragment.fqName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- NATIVE PART -->
|
||||
<application-components>
|
||||
<component>
|
||||
<implementation-class>org.jetbrains.konan.gradle.internal.KotlinNativeIdeInitializer</implementation-class>
|
||||
<implementation-class>org.jetbrains.kotlin.ide.konan.gradle.KotlinNativeIdeInitializer</implementation-class>
|
||||
</component>
|
||||
</application-components>
|
||||
<!-- /NATIVE PART -->
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<application-components>
|
||||
<component>
|
||||
<implementation-class>org.jetbrains.konan.KonanApplicationComponent</implementation-class>
|
||||
<implementation-class>org.jetbrains.kotlin.ide.konan.KotlinNativeApplicationComponent</implementation-class>
|
||||
</component>
|
||||
<component>
|
||||
<implementation-class>org.jetbrains.konan.analyser.index.KonanDescriptorManager</implementation-class>
|
||||
<implementation-class>org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeDescriptorManager</implementation-class>
|
||||
</component>
|
||||
</application-components>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<psi.classFileDecompiler implementation="org.jetbrains.konan.analyser.index.KonanMetadataDecompiler"/>
|
||||
<psi.classFileDecompiler implementation="org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeMetadataDecompiler"/>
|
||||
|
||||
<fileType.fileViewProviderFactory filetype="KNM"
|
||||
implementationClass="com.intellij.psi.ClassFileViewProviderFactory"/>
|
||||
<filetype.stubBuilder filetype="KNM" implementationClass="com.intellij.psi.impl.compiled.ClassFileStubBuilder"/>
|
||||
<filetype.decompiler filetype="KNM" implementationClass="com.intellij.psi.impl.compiled.ClassFileDecompiler"/>
|
||||
<fileTypeFactory implementation="org.jetbrains.konan.analyser.index.KonanMetaFileTypeFactory"/>
|
||||
<fileTypeFactory implementation="org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeMetaFileTypeFactory"/>
|
||||
<fileBasedIndex implementation="org.jetbrains.kotlin.ide.konan.index.KotlinNativeMetaFileIndex"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<binaryExtension implementation="org.jetbrains.konan.analyser.index.KonanMetaBinary"/>
|
||||
<binaryExtension implementation="org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeMetaBinary"/>
|
||||
<idePlatformKind implementation="org.jetbrains.kotlin.ide.konan.NativeIdePlatformKind"/>
|
||||
<idePlatformKindTooling implementation="org.jetbrains.kotlin.ide.konan.NativeIdePlatformKindTooling"/>
|
||||
<idePlatformKindResolution implementation="org.jetbrains.kotlin.ide.konan.NativePlatformKindResolution"/>
|
||||
|
||||
Reference in New Issue
Block a user