Use doResume name for suspend lambdas context (KT-16481)

#KT-16481 Fixed
This commit is contained in:
Nikolay Krasko
2017-02-25 02:35:41 +03:00
committed by Nikolay Krasko
parent dffbe0f707
commit f0be88fc07
5 changed files with 54 additions and 8 deletions
@@ -328,6 +328,11 @@ class CoroutineCodegen private constructor(
}
companion object {
fun shouldCreateByLambda(
originalSuspendLambdaDescriptor: CallableDescriptor,
declaration: KtElement): Boolean {
return (declaration is KtFunctionLiteral && originalSuspendLambdaDescriptor.isSuspendLambda)
}
@JvmStatic
fun createByLambda(
@@ -336,8 +341,7 @@ class CoroutineCodegen private constructor(
declaration: KtElement,
classBuilder: ClassBuilder
): ClosureCodegen? {
if (declaration !is KtFunctionLiteral) return null
if (!originalSuspendLambdaDescriptor.isSuspendLambda) return null
if (!shouldCreateByLambda(originalSuspendLambdaDescriptor, declaration)) return null
return CoroutineCodegen(
expressionCodegen,