Noinline support
Bug fix
This commit is contained in:
committed by
KonstantinAnisimov
parent
26f4271906
commit
bfc4e1106a
+8
-2
@@ -271,14 +271,16 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoid(
|
|||||||
if (irCall !is IrCallImpl) return irCall
|
if (irCall !is IrCallImpl) return irCall
|
||||||
|
|
||||||
val oldTypeArguments = (irCall as IrMemberAccessExpressionBase).typeArguments
|
val oldTypeArguments = (irCall as IrMemberAccessExpressionBase).typeArguments
|
||||||
|
if (typeArgsMap == null) return irCall
|
||||||
|
if (oldTypeArguments == null) return irCall
|
||||||
|
|
||||||
val substitutionContext = typeArgsMap!!.entries.associate {
|
val substitutionContext = typeArgsMap.entries.associate {
|
||||||
(typeParameter, typeArgument) ->
|
(typeParameter, typeArgument) ->
|
||||||
typeParameter.typeConstructor to TypeProjectionImpl(typeArgument)
|
typeParameter.typeConstructor to TypeProjectionImpl(typeArgument)
|
||||||
}
|
}
|
||||||
val typeSubstitutor = TypeSubstitutor.create(substitutionContext)
|
val typeSubstitutor = TypeSubstitutor.create(substitutionContext)
|
||||||
|
|
||||||
val newTypeArguments = oldTypeArguments!!.map {
|
val newTypeArguments = oldTypeArguments.map {
|
||||||
val typeParameterDescriptor = it.key
|
val typeParameterDescriptor = it.key
|
||||||
val oldTypeArgument = it.value
|
val oldTypeArgument = it.value
|
||||||
val newTypeArgument = typeSubstitutor.substitute(oldTypeArgument, Variance.INVARIANT) ?: oldTypeArgument
|
val newTypeArgument = typeSubstitutor.substitute(oldTypeArgument, Variance.INVARIANT) ?: oldTypeArgument
|
||||||
@@ -377,6 +379,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoid(
|
|||||||
val lambdaArgument = substituteMap[dispatchReceiver.descriptor] // Find expression to replace this parameter.
|
val lambdaArgument = substituteMap[dispatchReceiver.descriptor] // Find expression to replace this parameter.
|
||||||
if (lambdaArgument == null) return super.visitCall(irCall) // It is not function parameter - nothing to substitute.
|
if (lambdaArgument == null) return super.visitCall(irCall) // It is not function parameter - nothing to substitute.
|
||||||
|
|
||||||
|
val dispatchDescriptor = dispatchReceiver.descriptor
|
||||||
|
if (dispatchDescriptor is ValueParameterDescriptor &&
|
||||||
|
dispatchDescriptor.isNoinline) return super.visitCall(irCall)
|
||||||
|
|
||||||
val lambdaFunction = getLambdaFunction(lambdaArgument)
|
val lambdaFunction = getLambdaFunction(lambdaArgument)
|
||||||
if (lambdaFunction == null) return super.visitCall(irCall) // TODO
|
if (lambdaFunction == null) return super.visitCall(irCall) // TODO
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user