Fix ultra light class generation for private suspend methods
This commit is contained in:
-5
@@ -116,11 +116,6 @@ internal class UltraLightMembersCreator(
|
|||||||
|| ktFunction.hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME)
|
|| ktFunction.hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME)
|
||||||
) return emptyList()
|
) return emptyList()
|
||||||
|
|
||||||
|
|
||||||
if (ktFunction.modifierList?.hasSuspendModifier() == true && ktFunction.isPrivate()) {
|
|
||||||
return emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
var methodIndex = METHOD_INDEX_BASE
|
var methodIndex = METHOD_INDEX_BASE
|
||||||
val basicMethod = asJavaMethod(ktFunction, forceStatic, forcePrivate, methodIndex = methodIndex)
|
val basicMethod = asJavaMethod(ktFunction, forceStatic, forcePrivate, methodIndex = methodIndex)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -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.codegen.AsmUtil.RECEIVER_PARAMETER_NAME
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
import org.jetbrains.kotlin.psi.psiUtil.isPrivate
|
||||||
|
|
||||||
internal class KtUltraLightSuspendContinuationParameter(
|
internal class KtUltraLightSuspendContinuationParameter(
|
||||||
private val ktFunction: KtFunction,
|
private val ktFunction: KtFunction,
|
||||||
@@ -35,7 +36,7 @@ internal class KtUltraLightSuspendContinuationParameter(
|
|||||||
KtUltraLightElementWithNullabilityAnnotation<KtParameter, PsiParameter> {
|
KtUltraLightElementWithNullabilityAnnotation<KtParameter, PsiParameter> {
|
||||||
|
|
||||||
override val qualifiedNameForNullabilityAnnotation: String?
|
override val qualifiedNameForNullabilityAnnotation: String?
|
||||||
get() = computeQualifiedNameForNullabilityAnnotation(ktType)
|
get() = if (!ktFunction.isPrivate()) computeQualifiedNameForNullabilityAnnotation(ktType) else null
|
||||||
|
|
||||||
override val psiTypeForNullabilityAnnotation: PsiType? get() = psiType
|
override val psiTypeForNullabilityAnnotation: PsiType? get() = psiType
|
||||||
override val kotlinOrigin: KtParameter? = null
|
override val kotlinOrigin: KtParameter? = null
|
||||||
|
|||||||
+3
-1
@@ -21,10 +21,12 @@ UFile (package = test.pkg)
|
|||||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
UIdentifier (Identifier (suspendPrivate))
|
UIdentifier (Identifier (suspendPrivate))
|
||||||
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
|
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
|
||||||
UMethod (name = Context)
|
|
||||||
UMethod (name = suspendPrivate)
|
UMethod (name = suspendPrivate)
|
||||||
|
UParameter (name = $completion)
|
||||||
|
UAnnotation (fqName = null)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UReturnExpression
|
UReturnExpression
|
||||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
UIdentifier (Identifier (inner))
|
UIdentifier (Identifier (inner))
|
||||||
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
|
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
|
||||||
|
UMethod (name = Context)
|
||||||
|
|||||||
+3
-1
@@ -21,10 +21,12 @@ UFile (package = test.pkg)
|
|||||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
UIdentifier (Identifier (suspendPrivate))
|
UIdentifier (Identifier (suspendPrivate))
|
||||||
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
|
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
|
||||||
UMethod (name = Context)
|
|
||||||
UMethod (name = suspendPrivate)
|
UMethod (name = suspendPrivate)
|
||||||
|
UParameter (name = $completion)
|
||||||
|
UAnnotation (fqName = null)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UReturnExpression
|
UReturnExpression
|
||||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
UIdentifier (Identifier (inner))
|
UIdentifier (Identifier (inner))
|
||||||
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
|
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
|
||||||
|
UMethod (name = Context)
|
||||||
|
|||||||
+2
-2
@@ -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 {
|
public final fun inner(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
|
||||||
return suspendPrivate()
|
return suspendPrivate()
|
||||||
}
|
}
|
||||||
public fun Context() = UastEmptyExpression
|
private final fun suspendPrivate(@null $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
|
||||||
fun suspendPrivate() : int {
|
|
||||||
return inner()
|
return inner()
|
||||||
}
|
}
|
||||||
|
public fun Context() = UastEmptyExpression
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -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 {
|
public final fun inner(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
|
||||||
return suspendPrivate()
|
return suspendPrivate()
|
||||||
}
|
}
|
||||||
public fun Context() = UastEmptyExpression
|
private final fun suspendPrivate(@null $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
|
||||||
fun suspendPrivate() : int {
|
|
||||||
return inner()
|
return inner()
|
||||||
}
|
}
|
||||||
|
public fun Context() = UastEmptyExpression
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user