Skip to content

Commit 3934491

Browse files
committed
Kotlin: Refactor useFunction*
They now work in a way more similar to other families of functions we have.
1 parent ab19d8c commit 3934491

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,17 +1205,17 @@ open class KotlinUsesExtractor(
12051205
val ids = getLocallyVisibleFunctionLabels(f)
12061206
return ids.function.cast<T>()
12071207
} else {
1208-
val realFunction = kotlinFunctionToJavaEquivalent(f, noReplace)
1209-
return useFunctionCommon<T>(realFunction, getFunctionLabel(realFunction, classTypeArgsIncludingOuterClasses))
1208+
return useFunction(f, null, classTypeArgsIncludingOuterClasses, noReplace)
12101209
}
12111210
}
12121211

1213-
fun <T: DbCallable> useFunction(f: IrFunction, parentId: Label<out DbElement>, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, noReplace: Boolean = false) =
1214-
kotlinFunctionToJavaEquivalent(f, noReplace).let {
1215-
useFunctionCommon<T>(it, getFunctionLabel(it, parentId, classTypeArgsIncludingOuterClasses))
1212+
fun <T: DbCallable> useFunction(f: IrFunction, parentId: Label<out DbElement>?, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?, noReplace: Boolean = false): Label<out T> {
1213+
return kotlinFunctionToJavaEquivalent(f, noReplace).let {
1214+
useFunction(it, getFunctionLabel(it, parentId, classTypeArgsIncludingOuterClasses))
12161215
}
1216+
}
12171217

1218-
private fun <T: DbCallable> useFunctionCommon(f: IrFunction, label: String): Label<out T> {
1218+
private fun <T: DbCallable> useFunction(f: IrFunction, label: String): Label<out T> {
12191219
val id: Label<T> = tw.getLabelFor(label)
12201220
if (isExternalDeclaration(f)) {
12211221
extractFunctionLaterIfExternalFileMember(f)

0 commit comments

Comments
 (0)