Fix ultra light class generation for private suspend methods

This commit is contained in:
Mikhael Bogdanov
2021-03-01 12:51:30 +01:00
parent 989fea3399
commit 373d0ac660
6 changed files with 12 additions and 12 deletions
@@ -116,11 +116,6 @@ internal class UltraLightMembersCreator(
|| ktFunction.hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME)
) return emptyList()
if (ktFunction.modifierList?.hasSuspendModifier() == true && ktFunction.isPrivate()) {
return emptyList()
}
var methodIndex = METHOD_INDEX_BASE
val basicMethod = asJavaMethod(ktFunction, forceStatic, forcePrivate, methodIndex = methodIndex)
@@ -25,6 +25,7 @@ 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.*
import org.jetbrains.kotlin.psi.psiUtil.isPrivate
internal class KtUltraLightSuspendContinuationParameter(
private val ktFunction: KtFunction,
@@ -35,7 +36,7 @@ internal class KtUltraLightSuspendContinuationParameter(
KtUltraLightElementWithNullabilityAnnotation<KtParameter, PsiParameter> {
override val qualifiedNameForNullabilityAnnotation: String?
get() = computeQualifiedNameForNullabilityAnnotation(ktType)
get() = if (!ktFunction.isPrivate()) computeQualifiedNameForNullabilityAnnotation(ktType) else null
override val psiTypeForNullabilityAnnotation: PsiType? get() = psiType
override val kotlinOrigin: KtParameter? = null
+3 -1
View File
@@ -21,10 +21,12 @@ UFile (package = test.pkg)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (suspendPrivate))
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
UMethod (name = Context)
UMethod (name = suspendPrivate)
UParameter (name = $completion)
UAnnotation (fqName = null)
UBlockExpression
UReturnExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (inner))
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
UMethod (name = Context)
+3 -1
View File
@@ -21,10 +21,12 @@ UFile (package = test.pkg)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (suspendPrivate))
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
UMethod (name = Context)
UMethod (name = suspendPrivate)
UParameter (name = $completion)
UAnnotation (fqName = null)
UBlockExpression
UReturnExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (inner))
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
UMethod (name = Context)
+2 -2
View File
@@ -10,8 +10,8 @@ public final class Context {
public final fun inner(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
return suspendPrivate()
}
public fun Context() = UastEmptyExpression
fun suspendPrivate() : int {
private final fun suspendPrivate(@null $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
return inner()
}
public fun Context() = UastEmptyExpression
}
+2 -2
View File
@@ -10,8 +10,8 @@ public final class Context {
public final fun inner(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
return suspendPrivate()
}
public fun Context() = UastEmptyExpression
fun suspendPrivate() : int {
private final fun suspendPrivate(@null $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
return inner()
}
public fun Context() = UastEmptyExpression
}