@@ -1694,7 +1694,7 @@ open class KotlinFileExtractor(
16941694 result
16951695 }
16961696
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 {
16981698 val verbose = false
16991699 fun verboseln (s : String ) { if (verbose) println (s) }
17001700 verboseln(" Attempting match for $pkgName $classNameLogged $fName " )
@@ -1704,14 +1704,14 @@ open class KotlinFileExtractor(
17041704 }
17051705 val extensionReceiverParameter = target.extensionReceiverParameter
17061706 val targetClass = if (extensionReceiverParameter == null ) {
1707- if (hasQuestionMark == true ) {
1707+ if (isNullable == true ) {
17081708 verboseln(" Nullablility of type didn't match (target is not an extension method)" )
17091709 return false
17101710 }
17111711 target.parent
17121712 } else {
17131713 val st = extensionReceiverParameter.type as ? IrSimpleType
1714- if (hasQuestionMark != null && st?.hasQuestionMark != hasQuestionMark ) {
1714+ if (isNullable != null && st?.isNullable() != isNullable ) {
17151715 verboseln(" Nullablility of type didn't match" )
17161716 return false
17171717 }
@@ -1738,8 +1738,8 @@ open class KotlinFileExtractor(
17381738 return true
17391739 }
17401740
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 )
17431743
17441744 private fun isNumericFunction (target : IrFunction , fName : String ): Boolean {
17451745 return isFunction(target, " kotlin" , " Int" , fName) ||
@@ -2582,8 +2582,8 @@ open class KotlinFileExtractor(
25822582 indexVarDecl.initializer?.let { indexVarInitializer ->
25832583 (e.statements[2 ] as ? IrCall )?.let { arraySetCall ->
25842584 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 ) {
25872587 logger.errorElement(" Update RHS not found" , e)
25882588 return false
25892589 }
@@ -2596,7 +2596,7 @@ open class KotlinFileExtractor(
25962596 receiverVal -> receiverVal.symbol.owner == arrayVarDecl.symbol.owner
25972597 } ? : false
25982598 },
2599- updateRhs
2599+ updateRhs0
26002600 )?.let { updateRhs ->
26012601 val origin = e.origin
26022602 if (origin == null ) {
@@ -3421,15 +3421,11 @@ open class KotlinFileExtractor(
34213421
34223422 data class ReceiverInfo (val receiver : IrExpression , val type : IrType , val field : Label <DbField >, val indexOffset : Int )
34233423
3424- private fun makeReceiverInfo (callableReferenceExpr : IrCallableReference < out IrSymbol >, receiver : IrExpression ? , indexOffset : Int ): ReceiverInfo ? {
3424+ private fun makeReceiverInfo (receiver : IrExpression ? , indexOffset : Int ): ReceiverInfo ? {
34253425 if (receiver == null ) {
34263426 return null
34273427 }
34283428 val type = receiver.type
3429- if (type == null ) {
3430- logger.warnElement(" Receiver has no type" , callableReferenceExpr)
3431- return null
3432- }
34333429 val field: Label <DbField > = tw.getFreshIdLabel()
34343430 return ReceiverInfo (receiver, type, field, indexOffset)
34353431 }
@@ -3442,8 +3438,8 @@ open class KotlinFileExtractor(
34423438 : GeneratedClassHelper (locId, ids) {
34433439
34443440 // 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 )
34473443
34483444 fun extractReceiverField () {
34493445 val firstAssignmentStmtIdx = 1
0 commit comments