Kotlin/Native IDE plugin clean-up
- Re-organize classes
This commit is contained in:
+4
-2
@@ -10,5 +10,7 @@ import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider
|
|||||||
import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile
|
import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile
|
||||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
|
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
|
||||||
|
|
||||||
class KotlinNativeDecompiledFile(provider: KotlinDecompiledFileViewProvider, text: (VirtualFile) -> DecompiledText) :
|
class KotlinNativeDecompiledFile(
|
||||||
KtDecompiledFile(provider, text)
|
provider: KotlinDecompiledFileViewProvider,
|
||||||
|
text: (VirtualFile) -> DecompiledText
|
||||||
|
) : KtDecompiledFile(provider, text)
|
||||||
|
|||||||
+3
-8
@@ -2,13 +2,8 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||||
|
|
||||||
package org.jetbrains.kotlin.ide.konan.decompiler;
|
import org.jetbrains.kotlin.idea.util.KotlinBinaryExtension
|
||||||
|
|
||||||
import org.jetbrains.kotlin.idea.util.KotlinBinaryExtension;
|
class KotlinNativeMetaBinary : KotlinBinaryExtension(KotlinNativeMetaFileType)
|
||||||
|
|
||||||
public class KotlinNativeMetaBinary extends KotlinBinaryExtension {
|
|
||||||
public KotlinNativeMetaBinary() {
|
|
||||||
super(KotlinNativeMetaFileType.INSTANCE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||||
|
|
||||||
|
import com.intellij.openapi.fileTypes.FileType
|
||||||
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
|
import org.jetbrains.kotlin.library.KLIB_METADATA_FILE_EXTENSION
|
||||||
|
|
||||||
|
object KotlinNativeMetaFileType : FileType {
|
||||||
|
override fun getName() = "KNM"
|
||||||
|
override fun getDescription() = "Kotlin/Native Metadata"
|
||||||
|
override fun getDefaultExtension() = KLIB_METADATA_FILE_EXTENSION
|
||||||
|
override fun getIcon(): Nothing? = null
|
||||||
|
override fun isBinary() = true
|
||||||
|
override fun isReadOnly() = true
|
||||||
|
override fun getCharset(file: VirtualFile, content: ByteArray): Nothing? = null
|
||||||
|
|
||||||
|
const val STUB_VERSION = 2
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||||
|
|
||||||
|
import com.intellij.openapi.fileTypes.FileTypeConsumer
|
||||||
|
import com.intellij.openapi.fileTypes.FileTypeFactory
|
||||||
|
|
||||||
|
class KotlinNativeMetaFileTypeFactory : FileTypeFactory() {
|
||||||
|
|
||||||
|
override fun createFileTypes(consumer: FileTypeConsumer) = consumer.consume(KotlinNativeMetaFileType, KotlinNativeMetaFileType.defaultExtension)
|
||||||
|
}
|
||||||
-22
@@ -5,12 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||||
|
|
||||||
import com.intellij.openapi.fileTypes.FileType
|
|
||||||
import com.intellij.openapi.fileTypes.FileTypeConsumer
|
|
||||||
import com.intellij.openapi.fileTypes.FileTypeFactory
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion
|
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion
|
||||||
import org.jetbrains.kotlin.library.KLIB_METADATA_FILE_EXTENSION
|
|
||||||
import org.jetbrains.kotlin.library.metadata.KlibMetadataSerializerProtocol
|
import org.jetbrains.kotlin.library.metadata.KlibMetadataSerializerProtocol
|
||||||
import org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer
|
import org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer
|
||||||
|
|
||||||
@@ -22,26 +18,8 @@ class KotlinNativeMetadataDecompiler : KotlinNativeMetadataDecompilerBase<KlibMe
|
|||||||
{ KlibMetadataVersion.INVALID_VERSION },
|
{ KlibMetadataVersion.INVALID_VERSION },
|
||||||
KotlinNativeMetaFileType.STUB_VERSION
|
KotlinNativeMetaFileType.STUB_VERSION
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun doReadFile(file: VirtualFile): FileWithMetadata? {
|
override fun doReadFile(file: VirtualFile): FileWithMetadata? {
|
||||||
val fragment = KotlinNativeLoadingMetadataCache.getInstance().getCachedPackageFragment(file) ?: return null
|
val fragment = KotlinNativeLoadingMetadataCache.getInstance().getCachedPackageFragment(file) ?: return null
|
||||||
return FileWithMetadata.Compatible(fragment, KlibMetadataSerializerProtocol) //todo: check version compatibility
|
return FileWithMetadata.Compatible(fragment, KlibMetadataSerializerProtocol) //todo: check version compatibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object KotlinNativeMetaFileType : FileType {
|
|
||||||
override fun getName() = "KNM"
|
|
||||||
override fun getDescription() = "Kotlin/Native Metadata"
|
|
||||||
override fun getDefaultExtension() = KLIB_METADATA_FILE_EXTENSION
|
|
||||||
override fun getIcon(): Nothing? = null
|
|
||||||
override fun isBinary() = true
|
|
||||||
override fun isReadOnly() = true
|
|
||||||
override fun getCharset(file: VirtualFile, content: ByteArray): Nothing? = null
|
|
||||||
|
|
||||||
const val STUB_VERSION = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
class KotlinNativeMetaFileTypeFactory : FileTypeFactory() {
|
|
||||||
|
|
||||||
override fun createFileTypes(consumer: FileTypeConsumer) = consumer.consume(KotlinNativeMetaFileType, KotlinNativeMetaFileType.defaultExtension)
|
|
||||||
}
|
|
||||||
|
|||||||
-1
@@ -3,7 +3,6 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.ide.konan.decompiler
|
package org.jetbrains.kotlin.ide.konan.decompiler
|
||||||
|
|
||||||
import com.intellij.openapi.diagnostic.Logger
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
|
|||||||
Reference in New Issue
Block a user