[JVM_IR] Always look for default lambdas in the inliner.

This allows compiler plugins such as Compose to do custom
default argument handling in methods that do not have origin
`FUNCTION_FOR_DEFAULT_PARAMETER`.

The code still bails out early is there is not defaults
mask, so there should be no compile-time penalty.
This commit is contained in:
Mads Ager
2020-09-08 13:40:31 +02:00
committed by Alexander Udalov
parent a12e22bba4
commit 06680452dc
@@ -157,7 +157,8 @@ class IrInlineCodegen(
try { try {
performInline( performInline(
expression.symbol.owner.typeParameters.map { it.symbol }, expression.symbol.owner.typeParameters.map { it.symbol },
function.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER, // Always look for default lambdas to allow custom default argument handling in compiler plugins.
true,
false, false,
codegen.typeMapper.typeSystem, codegen.typeMapper.typeSystem,
registerLineNumberAfterwards = false, registerLineNumberAfterwards = false,
@@ -186,6 +187,7 @@ class IrInlineCodegen(
} }
override fun extractDefaultLambdas(node: MethodNode): List<DefaultLambda> { override fun extractDefaultLambdas(node: MethodNode): List<DefaultLambda> {
if (maskStartIndex == -1) return listOf()
return expandMaskConditionsAndUpdateVariableNodes( return expandMaskConditionsAndUpdateVariableNodes(
node, maskStartIndex, maskValues, methodHandleInDefaultMethodIndex, node, maskStartIndex, maskValues, methodHandleInDefaultMethodIndex,
extractDefaultLambdaOffsetAndDescriptor(jvmSignature, function), extractDefaultLambdaOffsetAndDescriptor(jvmSignature, function),