Skip to content

Commit c339a2d

Browse files
authored
Merge pull request #10273 from igfoo/igfoo/extractRawMethodAccess
Kotlin: Remove cast from extractRawMethodAccess
2 parents ed04bec + db1661f commit c339a2d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,12 +1436,14 @@ open class KotlinFileExtractor(
14361436
// type arguments at index -2, -3, ...
14371437
extractTypeArguments(typeArguments, locId, id, enclosingCallable, enclosingStmt, -2, true)
14381438

1439-
val isFunctionInvoke = drType != null
1440-
&& drType is IrSimpleType
1441-
&& drType.isFunctionOrKFunction()
1442-
&& callTarget.name.asString() == OperatorNameConventions.INVOKE.asString()
1443-
val isBigArityFunctionInvoke = isFunctionInvoke
1444-
&& (drType as IrSimpleType).arguments.size > BuiltInFunctionArity.BIG_ARITY
1439+
val (isFunctionInvoke, isBigArityFunctionInvoke) =
1440+
if (drType is IrSimpleType &&
1441+
drType.isFunctionOrKFunction() &&
1442+
callTarget.name.asString() == OperatorNameConventions.INVOKE.asString()) {
1443+
Pair(true, drType.arguments.size > BuiltInFunctionArity.BIG_ARITY)
1444+
} else {
1445+
Pair(false, false)
1446+
}
14451447

14461448
if (callTarget.isLocalFunction()) {
14471449
val ids = getLocallyVisibleFunctionLabels(callTarget)
@@ -1452,7 +1454,7 @@ open class KotlinFileExtractor(
14521454
extractNewExprForLocalFunction(ids, id, locId, enclosingCallable, enclosingStmt)
14531455
} else {
14541456
val methodId =
1455-
if (drType != null && extractClassTypeArguments && drType is IrSimpleType && !isUnspecialised(drType)) {
1457+
if (extractClassTypeArguments && drType is IrSimpleType && !isUnspecialised(drType)) {
14561458

14571459
val extractionMethod = if (isFunctionInvoke) {
14581460
// For `kotlin.FunctionX` and `kotlin.reflect.KFunctionX` interfaces, we're making sure that we

0 commit comments

Comments
 (0)