[ULC] Add support of const fields to multifile facade
This commit is contained in:
+4
-3
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
|||||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil.JVM_MULTIFILE_CLASS_SHORT
|
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil.JVM_MULTIFILE_CLASS_SHORT
|
||||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil.findAnnotationEntryOnFileNoResolve
|
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil.findAnnotationEntryOnFileNoResolve
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||||
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||||
@@ -130,11 +131,11 @@ class KtUltraLightClassForFacade(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val _ownFields: List<KtLightField> by lazyPub {
|
private val _ownFields: List<KtLightField> by lazyPub {
|
||||||
if (multiFileClass) return@lazyPub emptyList()
|
|
||||||
|
|
||||||
hashSetOf<String>().let { nameCache ->
|
hashSetOf<String>().let { nameCache ->
|
||||||
filesWithSupportsWithCreators.flatMap { (file, _, creator) ->
|
filesWithSupportsWithCreators.flatMap { (file, _, creator) ->
|
||||||
file.declarations.filterIsInstance<KtProperty>().mapNotNull {
|
val allProperties = file.declarations.filterIsInstance<KtProperty>()
|
||||||
|
val properties = if (multiFileClass) allProperties.filter { it.hasModifier(KtTokens.CONST_KEYWORD) } else allProperties
|
||||||
|
properties.mapNotNull {
|
||||||
creator.createPropertyField(it, nameCache, forceStatic = true)
|
creator.createPropertyField(it, nameCache, forceStatic = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ fun foo() = 42
|
|||||||
|
|
||||||
val x = 24
|
val x = 24
|
||||||
|
|
||||||
private fun privateFoo(): Int = 3
|
private fun privateFoo(): Int = 3
|
||||||
|
|
||||||
|
const val x1 = 42
|
||||||
@@ -3,4 +3,6 @@
|
|||||||
|
|
||||||
fun bar() = 24
|
fun bar() = 24
|
||||||
|
|
||||||
val y = 24
|
val y = 24
|
||||||
|
|
||||||
|
const val y1 = 42
|
||||||
Reference in New Issue
Block a user