Kotlin: Remove another not-null-expr in the extractor

This commit is contained in:
Ian Lynagh
2022-08-23 12:05:14 +01:00
parent 98dd2448ff
commit d3a8060e34

View File

@@ -3405,8 +3405,7 @@ open class KotlinFileExtractor(
expressionTypeArgs: List<IrType>, // type arguments of the extracted expression expressionTypeArgs: List<IrType>, // type arguments of the extracted expression
classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, // type arguments of the class containing the callable reference classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, // type arguments of the class containing the callable reference
dispatchReceiverIdx: Int = -1, // dispatch receiver index: -1 in case of functions, -2 for constructors dispatchReceiverIdx: Int = -1, // dispatch receiver index: -1 in case of functions, -2 for constructors
isBigArity: Boolean = false, // whether a big arity `invoke` is being extracted bigArityParameterTypes: List<IrType>? = null // parameter types used for the cast expressions in a big arity `invoke` invocation. null if not a big arity invocation.
bigArityParameterTypes: List<IrType>? = null // parameter types used for the cast expressions in the big arity `invoke` invocation
) { ) {
// Return statement of generated function: // Return statement of generated function:
val retId = tw.getFreshIdLabel<DbReturnstmt>() val retId = tw.getFreshIdLabel<DbReturnstmt>()
@@ -3464,10 +3463,10 @@ open class KotlinFileExtractor(
extensionIdxOffset = 0 extensionIdxOffset = 0
} }
if (isBigArity) { if (bigArityParameterTypes != null) {
// In case we're extracting a big arity function reference: // In case we're extracting a big arity function reference:
addArgumentsToInvocationInInvokeNBody( addArgumentsToInvocationInInvokeNBody(
bigArityParameterTypes!!, labels, retId, callId, locId, bigArityParameterTypes, labels, retId, callId, locId,
{ exp -> writeExpressionMetadataToTrapFile(exp, labels.methodId, retId) }, { exp -> writeExpressionMetadataToTrapFile(exp, labels.methodId, retId) },
extensionIdxOffset, useFirstArgAsDispatch, dispatchReceiverIdx) extensionIdxOffset, useFirstArgAsDispatch, dispatchReceiverIdx)
} else { } else {
@@ -3814,8 +3813,7 @@ open class KotlinFileExtractor(
expressionTypeArguments, expressionTypeArguments,
classTypeArguments, classTypeArguments,
dispatchReceiverIdx, dispatchReceiverIdx,
isBigArity, if (isBigArity) parameterTypes.dropLast(1) else null)
parameterTypes.dropLast(1))
val typeAccessArguments = if (isBigArity) listOf(parameterTypes.last()) else parameterTypes val typeAccessArguments = if (isBigArity) listOf(parameterTypes.last()) else parameterTypes
if (target is IrConstructorSymbol) { if (target is IrConstructorSymbol) {