[ULC] Fixed invalid access to lightclass infrastructure from UL
This commit is contained in:
+1
@@ -56,6 +56,7 @@ class KtUltraLightClassForFacade(
|
||||
files.flatMap { file ->
|
||||
file.annotationEntries.map { entry ->
|
||||
KtLightAnnotationForSourceEntry(
|
||||
name = entry.shortName?.identifier,
|
||||
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
||||
kotlinOrigin = entry,
|
||||
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.descriptors.*
|
||||
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.codegen.AsmUtil.LABELED_THIS_PARAMETER
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil.RECEIVER_PARAMETER_NAME
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
internal class KtUltraLightSuspendContinuationParameter(
|
||||
private val ktFunction: KtFunction,
|
||||
@@ -180,6 +177,12 @@ internal class KtUltraLightParameterForSource(
|
||||
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 getTextRange(): TextRange = kotlinOrigin.textRange
|
||||
override fun getTextOffset(): Int = kotlinOrigin.textOffset
|
||||
|
||||
@@ -522,12 +522,13 @@ internal fun KtUltraLightSupport.findAnnotation(owner: KtAnnotated, fqName: FqNa
|
||||
|
||||
internal fun List<KtAnnotationEntry>.toLightAnnotations(
|
||||
parent: PsiElement,
|
||||
site: AnnotationUseSiteTarget
|
||||
site: AnnotationUseSiteTarget?
|
||||
): List<KtLightAnnotationForSourceEntry> =
|
||||
filter {
|
||||
it.useSiteTarget?.getAnnotationUseSiteTarget() == site
|
||||
}.map { entry ->
|
||||
KtLightAnnotationForSourceEntry(
|
||||
name = entry.shortName?.identifier,
|
||||
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
||||
kotlinOrigin = entry,
|
||||
parent = parent,
|
||||
|
||||
+7
-1
@@ -178,7 +178,13 @@ private fun lightAnnotationsForEntries(lightModifierList: KtLightModifierList<*>
|
||||
}
|
||||
} 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(
|
||||
private val name: String?,
|
||||
private val lazyQualifiedName: () -> String?,
|
||||
override val kotlinOrigin: KtCallElement,
|
||||
parent: PsiElement,
|
||||
@@ -87,7 +88,7 @@ class KtLightAnnotationForSourceEntry(
|
||||
|
||||
override fun getQualifiedName(): String? = _qualifiedName
|
||||
|
||||
override fun getName(): String? = null
|
||||
override fun getName(): String? = name
|
||||
|
||||
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) }
|
||||
if (annotationName != null) {
|
||||
return KtLightAnnotationForSourceEntry(
|
||||
{ annotationName },
|
||||
argument,
|
||||
lightParent,
|
||||
name = annotationName,
|
||||
lazyQualifiedName = { annotationName },
|
||||
kotlinOrigin = argument,
|
||||
parent = lightParent,
|
||||
lazyClsDelegate = null
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user