[ULC] Fixed invalid access to lightclass infrastructure from UL
This commit is contained in:
+1
@@ -56,6 +56,7 @@ class KtUltraLightClassForFacade(
|
|||||||
files.flatMap { file ->
|
files.flatMap { file ->
|
||||||
file.annotationEntries.map { entry ->
|
file.annotationEntries.map { entry ->
|
||||||
KtLightAnnotationForSourceEntry(
|
KtLightAnnotationForSourceEntry(
|
||||||
|
name = entry.shortName?.identifier,
|
||||||
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
||||||
kotlinOrigin = entry,
|
kotlinOrigin = entry,
|
||||||
parent = _modifierList,
|
parent = _modifierList,
|
||||||
|
|||||||
+7
-4
@@ -20,14 +20,11 @@ import org.jetbrains.kotlin.codegen.AsmUtil
|
|||||||
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
|
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
|
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
|
||||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
|
||||||
import org.jetbrains.kotlin.psi.KtFunction
|
|
||||||
import org.jetbrains.kotlin.psi.KtParameter
|
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil.LABELED_THIS_PARAMETER
|
import org.jetbrains.kotlin.codegen.AsmUtil.LABELED_THIS_PARAMETER
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil.RECEIVER_PARAMETER_NAME
|
import org.jetbrains.kotlin.codegen.AsmUtil.RECEIVER_PARAMETER_NAME
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||||
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
|
||||||
internal class KtUltraLightSuspendContinuationParameter(
|
internal class KtUltraLightSuspendContinuationParameter(
|
||||||
private val ktFunction: KtFunction,
|
private val ktFunction: KtFunction,
|
||||||
@@ -180,6 +177,12 @@ internal class KtUltraLightParameterForSource(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val givenAnnotations: List<KtLightAbstractAnnotation>?
|
||||||
|
get() {
|
||||||
|
val site = if (kotlinOrigin.hasValOrVar()) AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER else null
|
||||||
|
return kotlinOrigin.annotationEntries.toLightAnnotations(this, site)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getText(): String? = kotlinOrigin.text
|
override fun getText(): String? = kotlinOrigin.text
|
||||||
override fun getTextRange(): TextRange = kotlinOrigin.textRange
|
override fun getTextRange(): TextRange = kotlinOrigin.textRange
|
||||||
override fun getTextOffset(): Int = kotlinOrigin.textOffset
|
override fun getTextOffset(): Int = kotlinOrigin.textOffset
|
||||||
|
|||||||
@@ -522,12 +522,13 @@ internal fun KtUltraLightSupport.findAnnotation(owner: KtAnnotated, fqName: FqNa
|
|||||||
|
|
||||||
internal fun List<KtAnnotationEntry>.toLightAnnotations(
|
internal fun List<KtAnnotationEntry>.toLightAnnotations(
|
||||||
parent: PsiElement,
|
parent: PsiElement,
|
||||||
site: AnnotationUseSiteTarget
|
site: AnnotationUseSiteTarget?
|
||||||
): List<KtLightAnnotationForSourceEntry> =
|
): List<KtLightAnnotationForSourceEntry> =
|
||||||
filter {
|
filter {
|
||||||
it.useSiteTarget?.getAnnotationUseSiteTarget() == site
|
it.useSiteTarget?.getAnnotationUseSiteTarget() == site
|
||||||
}.map { entry ->
|
}.map { entry ->
|
||||||
KtLightAnnotationForSourceEntry(
|
KtLightAnnotationForSourceEntry(
|
||||||
|
name = entry.shortName?.identifier,
|
||||||
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
||||||
kotlinOrigin = entry,
|
kotlinOrigin = entry,
|
||||||
parent = parent,
|
parent = parent,
|
||||||
|
|||||||
+7
-1
@@ -178,7 +178,13 @@ private fun lightAnnotationsForEntries(lightModifierList: KtLightModifierList<*>
|
|||||||
}
|
}
|
||||||
} else null
|
} else null
|
||||||
|
|
||||||
KtLightAnnotationForSourceEntry({ fqName }, entry, lightModifierList, lazyClsDelegate)
|
KtLightAnnotationForSourceEntry(
|
||||||
|
name = entry.shortName?.identifier,
|
||||||
|
lazyQualifiedName = { fqName },
|
||||||
|
kotlinOrigin = entry,
|
||||||
|
parent = lightModifierList,
|
||||||
|
lazyClsDelegate = lazyClsDelegate
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ abstract class KtLightAbstractAnnotation(parent: PsiElement, computeDelegate: La
|
|||||||
}
|
}
|
||||||
|
|
||||||
class KtLightAnnotationForSourceEntry(
|
class KtLightAnnotationForSourceEntry(
|
||||||
|
private val name: String?,
|
||||||
private val lazyQualifiedName: () -> String?,
|
private val lazyQualifiedName: () -> String?,
|
||||||
override val kotlinOrigin: KtCallElement,
|
override val kotlinOrigin: KtCallElement,
|
||||||
parent: PsiElement,
|
parent: PsiElement,
|
||||||
@@ -87,7 +88,7 @@ class KtLightAnnotationForSourceEntry(
|
|||||||
|
|
||||||
override fun getQualifiedName(): String? = _qualifiedName
|
override fun getQualifiedName(): String? = _qualifiedName
|
||||||
|
|
||||||
override fun getName(): String? = null
|
override fun getName(): String? = name
|
||||||
|
|
||||||
override fun findAttributeValue(name: String?) = getAttributeValue(name, true)
|
override fun findAttributeValue(name: String?) = getAttributeValue(name, true)
|
||||||
|
|
||||||
@@ -397,9 +398,10 @@ fun convertToLightAnnotationMemberValue(lightParent: PsiElement, argument: KtExp
|
|||||||
val annotationName = argument.calleeExpression?.let { getAnnotationName(it) }
|
val annotationName = argument.calleeExpression?.let { getAnnotationName(it) }
|
||||||
if (annotationName != null) {
|
if (annotationName != null) {
|
||||||
return KtLightAnnotationForSourceEntry(
|
return KtLightAnnotationForSourceEntry(
|
||||||
{ annotationName },
|
name = annotationName,
|
||||||
argument,
|
lazyQualifiedName = { annotationName },
|
||||||
lightParent,
|
kotlinOrigin = argument,
|
||||||
|
parent = lightParent,
|
||||||
lazyClsDelegate = null
|
lazyClsDelegate = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user