JVM_IR. Support inlining of bound CR

This commit is contained in:
Mikhael Bogdanov
2019-11-20 10:56:53 +01:00
parent 42deb7db48
commit 4b6202c902
9 changed files with 54 additions and 4 deletions
@@ -217,14 +217,16 @@ class IrExpressionLambdaImpl(
private val loweredMethod = methodSignatureMapper.mapAsmMethod(function.getOrCreateSuspendFunctionViewIfNeeded(context))
val capturedParamsInDesc: List<Type> =
loweredMethod.argumentTypes.drop(if (isExtensionLambda) 1 else 0).take(capturedVars.size)
val capturedParamsInDesc: List<Type> = if (isBoundCallableReference) {
loweredMethod.argumentTypes.take(1)
} else loweredMethod.argumentTypes.drop(if (isExtensionLambda) 1 else 0).take(capturedVars.size)
override val invokeMethod: Method = loweredMethod.let {
Method(
it.name,
it.returnType,
((if (isExtensionLambda) it.argumentTypes.take(1) else emptyList()) +
(if (isBoundCallableReference) it.argumentTypes.drop(1)
else (if (isExtensionLambda) it.argumentTypes.take(1) else emptyList()) +
it.argumentTypes.drop((if (isExtensionLambda) 1 else 0) + capturedVars.size)).toTypedArray()
)
}