Skip to content

Commit b451020

Browse files
authoredOct 7, 2022
Merge pull request #10734 from github/smowton/fix/move-overloads-together
Kotlin: keep method overloads together
2 parents dd50fe3 + 115d4de commit b451020

File tree

1 file changed

+49
-50
lines changed

1 file changed

+49
-50
lines changed
 

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

+49-50
Original file line numberDiff line numberDiff line change
@@ -1769,56 +1769,6 @@ open class KotlinFileExtractor(
17691769
extractCallValueArguments(id, valueArgsWithDummies + extraArgs, enclosingStmt, enclosingCallable, nextIdx)
17701770
}
17711771

1772-
fun extractRawMethodAccess(
1773-
syntacticCallTarget: IrFunction,
1774-
callsite: IrCall,
1775-
enclosingCallable: Label<out DbCallable>,
1776-
callsiteParent: Label<out DbExprparent>,
1777-
childIdx: Int,
1778-
enclosingStmt: Label<out DbStmt>,
1779-
valueArguments: List<IrExpression?>,
1780-
dispatchReceiver: IrExpression?,
1781-
extensionReceiver: IrExpression?,
1782-
typeArguments: List<IrType> = listOf(),
1783-
extractClassTypeArguments: Boolean = false,
1784-
superQualifierSymbol: IrClassSymbol? = null) {
1785-
1786-
val locId = tw.getLocation(callsite)
1787-
1788-
if (valueArguments.any { it == null }) {
1789-
extractsDefaultsCall(
1790-
syntacticCallTarget,
1791-
locId,
1792-
callsite,
1793-
enclosingCallable,
1794-
callsiteParent,
1795-
childIdx,
1796-
enclosingStmt,
1797-
valueArguments,
1798-
dispatchReceiver,
1799-
extensionReceiver
1800-
)
1801-
} else {
1802-
extractRawMethodAccess(
1803-
syntacticCallTarget,
1804-
locId,
1805-
callsite.type,
1806-
enclosingCallable,
1807-
callsiteParent,
1808-
childIdx,
1809-
enclosingStmt,
1810-
valueArguments.size,
1811-
{ argParent, idxOffset -> extractCallValueArguments(argParent, valueArguments, enclosingStmt, enclosingCallable, idxOffset) },
1812-
dispatchReceiver?.type,
1813-
dispatchReceiver?.let { { callId -> extractExpressionExpr(dispatchReceiver, enclosingCallable, callId, -1, enclosingStmt) } },
1814-
extensionReceiver?.let { { argParent -> extractExpressionExpr(extensionReceiver, enclosingCallable, argParent, 0, enclosingStmt) } },
1815-
typeArguments,
1816-
extractClassTypeArguments,
1817-
superQualifierSymbol
1818-
)
1819-
}
1820-
}
1821-
18221772
private fun getFunctionInvokeMethod(typeArgs: List<IrTypeArgument>): IrFunction? {
18231773
// For `kotlin.FunctionX` and `kotlin.reflect.KFunctionX` interfaces, we're making sure that we
18241774
// extract the call to the `invoke` method that does exist, `kotlin.jvm.functions.FunctionX::invoke`.
@@ -1877,6 +1827,55 @@ open class KotlinFileExtractor(
18771827
}
18781828
}
18791829

1830+
fun extractRawMethodAccess(
1831+
syntacticCallTarget: IrFunction,
1832+
callsite: IrCall,
1833+
enclosingCallable: Label<out DbCallable>,
1834+
callsiteParent: Label<out DbExprparent>,
1835+
childIdx: Int,
1836+
enclosingStmt: Label<out DbStmt>,
1837+
valueArguments: List<IrExpression?>,
1838+
dispatchReceiver: IrExpression?,
1839+
extensionReceiver: IrExpression?,
1840+
typeArguments: List<IrType> = listOf(),
1841+
extractClassTypeArguments: Boolean = false,
1842+
superQualifierSymbol: IrClassSymbol? = null) {
1843+
1844+
val locId = tw.getLocation(callsite)
1845+
1846+
if (valueArguments.any { it == null }) {
1847+
extractsDefaultsCall(
1848+
syntacticCallTarget,
1849+
locId,
1850+
callsite,
1851+
enclosingCallable,
1852+
callsiteParent,
1853+
childIdx,
1854+
enclosingStmt,
1855+
valueArguments,
1856+
dispatchReceiver,
1857+
extensionReceiver
1858+
)
1859+
} else {
1860+
extractRawMethodAccess(
1861+
syntacticCallTarget,
1862+
locId,
1863+
callsite.type,
1864+
enclosingCallable,
1865+
callsiteParent,
1866+
childIdx,
1867+
enclosingStmt,
1868+
valueArguments.size,
1869+
{ argParent, idxOffset -> extractCallValueArguments(argParent, valueArguments, enclosingStmt, enclosingCallable, idxOffset) },
1870+
dispatchReceiver?.type,
1871+
dispatchReceiver?.let { { callId -> extractExpressionExpr(dispatchReceiver, enclosingCallable, callId, -1, enclosingStmt) } },
1872+
extensionReceiver?.let { { argParent -> extractExpressionExpr(extensionReceiver, enclosingCallable, argParent, 0, enclosingStmt) } },
1873+
typeArguments,
1874+
extractClassTypeArguments,
1875+
superQualifierSymbol
1876+
)
1877+
}
1878+
}
18801879

18811880
fun extractRawMethodAccess(
18821881
syntacticCallTarget: IrFunction,

0 commit comments

Comments
 (0)