@@ -1694,7 +1694,7 @@ open class KotlinFileExtractor(
1694
1694
result
1695
1695
}
1696
1696
1697
- private fun isFunction (target : IrFunction , pkgName : String , classNameLogged : String , classNamePredicate : (String ) -> Boolean , fName : String , hasQuestionMark : Boolean? = false): Boolean {
1697
+ private fun isFunction (target : IrFunction , pkgName : String , classNameLogged : String , classNamePredicate : (String ) -> Boolean , fName : String , isNullable : Boolean? = false): Boolean {
1698
1698
val verbose = false
1699
1699
fun verboseln (s : String ) { if (verbose) println (s) }
1700
1700
verboseln(" Attempting match for $pkgName $classNameLogged $fName " )
@@ -1704,14 +1704,14 @@ open class KotlinFileExtractor(
1704
1704
}
1705
1705
val extensionReceiverParameter = target.extensionReceiverParameter
1706
1706
val targetClass = if (extensionReceiverParameter == null ) {
1707
- if (hasQuestionMark == true ) {
1707
+ if (isNullable == true ) {
1708
1708
verboseln(" Nullablility of type didn't match (target is not an extension method)" )
1709
1709
return false
1710
1710
}
1711
1711
target.parent
1712
1712
} else {
1713
1713
val st = extensionReceiverParameter.type as ? IrSimpleType
1714
- if (hasQuestionMark != null && st?.hasQuestionMark != hasQuestionMark ) {
1714
+ if (isNullable != null && st?.isNullable() != isNullable ) {
1715
1715
verboseln(" Nullablility of type didn't match" )
1716
1716
return false
1717
1717
}
@@ -1738,8 +1738,8 @@ open class KotlinFileExtractor(
1738
1738
return true
1739
1739
}
1740
1740
1741
- private fun isFunction (target : IrFunction , pkgName : String , className : String , fName : String , hasQuestionMark : Boolean? = false) =
1742
- isFunction(target, pkgName, className, { it == className }, fName, hasQuestionMark )
1741
+ private fun isFunction (target : IrFunction , pkgName : String , className : String , fName : String , isNullable : Boolean? = false) =
1742
+ isFunction(target, pkgName, className, { it == className }, fName, isNullable )
1743
1743
1744
1744
private fun isNumericFunction (target : IrFunction , fName : String ): Boolean {
1745
1745
return isFunction(target, " kotlin" , " Int" , fName) ||
@@ -2582,8 +2582,8 @@ open class KotlinFileExtractor(
2582
2582
indexVarDecl.initializer?.let { indexVarInitializer ->
2583
2583
(e.statements[2 ] as ? IrCall )?.let { arraySetCall ->
2584
2584
if (isFunction(arraySetCall.symbol.owner, " kotlin" , " (some array type)" , { isArrayType(it) }, " set" )) {
2585
- val updateRhs = arraySetCall.getValueArgument(1 )
2586
- if (updateRhs == null ) {
2585
+ val updateRhs0 = arraySetCall.getValueArgument(1 )
2586
+ if (updateRhs0 == null ) {
2587
2587
logger.errorElement(" Update RHS not found" , e)
2588
2588
return false
2589
2589
}
@@ -2596,7 +2596,7 @@ open class KotlinFileExtractor(
2596
2596
receiverVal -> receiverVal.symbol.owner == arrayVarDecl.symbol.owner
2597
2597
} ? : false
2598
2598
},
2599
- updateRhs
2599
+ updateRhs0
2600
2600
)?.let { updateRhs ->
2601
2601
val origin = e.origin
2602
2602
if (origin == null ) {
@@ -3421,15 +3421,11 @@ open class KotlinFileExtractor(
3421
3421
3422
3422
data class ReceiverInfo (val receiver : IrExpression , val type : IrType , val field : Label <DbField >, val indexOffset : Int )
3423
3423
3424
- private fun makeReceiverInfo (callableReferenceExpr : IrCallableReference < out IrSymbol >, receiver : IrExpression ? , indexOffset : Int ): ReceiverInfo ? {
3424
+ private fun makeReceiverInfo (receiver : IrExpression ? , indexOffset : Int ): ReceiverInfo ? {
3425
3425
if (receiver == null ) {
3426
3426
return null
3427
3427
}
3428
3428
val type = receiver.type
3429
- if (type == null ) {
3430
- logger.warnElement(" Receiver has no type" , callableReferenceExpr)
3431
- return null
3432
- }
3433
3429
val field: Label <DbField > = tw.getFreshIdLabel()
3434
3430
return ReceiverInfo (receiver, type, field, indexOffset)
3435
3431
}
@@ -3442,8 +3438,8 @@ open class KotlinFileExtractor(
3442
3438
: GeneratedClassHelper (locId, ids) {
3443
3439
3444
3440
// Only one of the receivers can be non-null, but we defensively handle the case when both are null anyway
3445
- private val dispatchReceiverInfo = makeReceiverInfo(callableReferenceExpr, callableReferenceExpr .dispatchReceiver, 0 )
3446
- private val extensionReceiverInfo = makeReceiverInfo(callableReferenceExpr, callableReferenceExpr .extensionReceiver, if (dispatchReceiverInfo == null ) 0 else 1 )
3441
+ private val dispatchReceiverInfo = makeReceiverInfo(callableReferenceExpr.dispatchReceiver, 0 )
3442
+ private val extensionReceiverInfo = makeReceiverInfo(callableReferenceExpr.extensionReceiver, if (dispatchReceiverInfo == null ) 0 else 1 )
3447
3443
3448
3444
fun extractReceiverField () {
3449
3445
val firstAssignmentStmtIdx = 1
0 commit comments