@@ -14,31 +14,36 @@ import org.jetbrains.kotlin.asJava.elements.KtLightMethod
14
14
import org.jetbrains.kotlin.asJava.elements.KtLightSimpleModifierList
15
15
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
16
16
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
17
- import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
18
- import org.jetbrains.kotlin.psi.KtCallableDeclaration
19
- import org.jetbrains.kotlin.psi.KtDeclaration
20
- import org.jetbrains.kotlin.psi.KtParameter
21
17
import org.jetbrains.kotlin.types.KotlinType
22
18
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_CONTINUATION_PARAMETER
23
- import org.jetbrains.kotlin.codegen.kotlinType
24
19
import org.jetbrains.kotlin.descriptors.*
25
20
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
26
- import org.jetbrains.kotlin.psi.KtFunction
21
+ import org.jetbrains.kotlin.psi.*
27
22
28
23
internal class KtUltraLightSuspendContinuationParameter (
29
24
private val ktFunction : KtFunction ,
30
25
support : KtUltraLightSupport ,
31
26
method : KtLightMethod
32
- ) : org.jetbrains.kotlin.asJava.elements.LightParameter(SUSPEND_FUNCTION_CONTINUATION_PARAMETER , PsiType .NULL , method, method.language) {
27
+ ) : org.jetbrains.kotlin.asJava.elements.LightParameter(SUSPEND_FUNCTION_CONTINUATION_PARAMETER , PsiType .NULL , method, method.language),
28
+ KtUltraLightElementWithNullabilityAnnotation <KtDeclaration , PsiParameter > {
33
29
34
- private val psiType by lazyPub {
30
+ override val kotlinTypeForNullabilityAnnotation: KotlinType ? get() = ktType
31
+ override val psiTypeForNullabilityAnnotation: PsiType ? get() = psiType
32
+ override val kotlinOrigin: KtDeclaration ? = null
33
+ override val clsDelegate: PsiParameter
34
+ get() = throw IllegalStateException (" Cls delegate shouldn't be loaded for ultra-light PSI!" )
35
+
36
+ private val ktType by lazyPub {
35
37
val descriptor = ktFunction.resolve() as ? FunctionDescriptor
36
- val returnType = descriptor?.returnType ? : return @lazyPub PsiType .NULL
37
- val typeFromDescriptor = support.moduleDescriptor.getContinuationOfTypeOrAny(returnType, support.isReleasedCoroutine)
38
- typeFromDescriptor.asPsiType(support, TypeMappingMode .DEFAULT , method)
38
+ val returnType = descriptor?.returnType ? : return @lazyPub null
39
+ support.moduleDescriptor.getContinuationOfTypeOrAny(returnType, support.isReleasedCoroutine)
39
40
}
40
41
41
- private val lightModifierList by lazyPub { KtLightSimpleModifierList (method, emptySet()) }
42
+ private val psiType by lazyPub {
43
+ ktType?.asPsiType(support, TypeMappingMode .DEFAULT , method) ? : PsiType .NULL
44
+ }
45
+
46
+ private val lightModifierList by lazyPub { KtLightSimpleModifierList (this , emptySet()) }
42
47
43
48
override fun getType (): PsiType = psiType
44
49
0 commit comments