@@ -888,6 +888,10 @@ open class KotlinFileExtractor(
888
888
if (shortName.nameInDB != shortName.kotlinName) {
889
889
tw.writeKtFunctionOriginalNames(methodId, shortName.kotlinName)
890
890
}
891
+
892
+ if (f.hasInterfaceParent() && f.body != null ) {
893
+ addModifiers(id, " default" ) // The actual output class file may or may not have this modifier, depending on the -Xjvm-default setting.
894
+ }
891
895
}
892
896
893
897
tw.writeHasLocation(id, locId)
@@ -1386,7 +1390,8 @@ open class KotlinFileExtractor(
1386
1390
dispatchReceiver : IrExpression ? ,
1387
1391
extensionReceiver : IrExpression ? ,
1388
1392
typeArguments : List <IrType > = listOf(),
1389
- extractClassTypeArguments : Boolean = false) {
1393
+ extractClassTypeArguments : Boolean = false,
1394
+ superQualifierSymbol : IrClassSymbol ? = null) {
1390
1395
1391
1396
val locId = tw.getLocation(callsite)
1392
1397
@@ -1404,7 +1409,8 @@ open class KotlinFileExtractor(
1404
1409
dispatchReceiver?.let { { callId -> extractExpressionExpr(dispatchReceiver, enclosingCallable, callId, - 1 , enclosingStmt) } },
1405
1410
extensionReceiver?.let { { argParent -> extractExpressionExpr(extensionReceiver, enclosingCallable, argParent, 0 , enclosingStmt) } },
1406
1411
typeArguments,
1407
- extractClassTypeArguments
1412
+ extractClassTypeArguments,
1413
+ superQualifierSymbol
1408
1414
)
1409
1415
1410
1416
}
@@ -1424,7 +1430,8 @@ open class KotlinFileExtractor(
1424
1430
extractDispatchReceiver : ((Label <out DbExpr >) -> Unit )? ,
1425
1431
extractExtensionReceiver : ((Label <out DbExpr >) -> Unit )? ,
1426
1432
typeArguments : List <IrType > = listOf(),
1427
- extractClassTypeArguments : Boolean = false) {
1433
+ extractClassTypeArguments : Boolean = false,
1434
+ superQualifierSymbol : IrClassSymbol ? = null) {
1428
1435
1429
1436
val callTarget = syntacticCallTarget.target.realOverrideTarget
1430
1437
val id = tw.getFreshIdLabel<DbMethodaccess >()
@@ -1483,6 +1490,8 @@ open class KotlinFileExtractor(
1483
1490
1484
1491
if (callTarget.shouldExtractAsStatic) {
1485
1492
extractStaticTypeAccessQualifier(callTarget, id, locId, enclosingCallable, enclosingStmt)
1493
+ } else if (superQualifierSymbol != null ) {
1494
+ extractSuperAccess(superQualifierSymbol.typeWith(), enclosingCallable, id, - 1 , enclosingStmt, locId)
1486
1495
} else if (extractDispatchReceiver != null ) {
1487
1496
extractDispatchReceiver(id)
1488
1497
}
@@ -1744,7 +1753,7 @@ open class KotlinFileExtractor(
1744
1753
else
1745
1754
listOf ()
1746
1755
1747
- extractRawMethodAccess(syntacticCallTarget, c, callable, parent, idx, enclosingStmt, (0 until c.valueArgumentsCount).map { c.getValueArgument(it) }, c.dispatchReceiver, c.extensionReceiver, typeArgs, extractClassTypeArguments)
1756
+ extractRawMethodAccess(syntacticCallTarget, c, callable, parent, idx, enclosingStmt, (0 until c.valueArgumentsCount).map { c.getValueArgument(it) }, c.dispatchReceiver, c.extensionReceiver, typeArgs, extractClassTypeArguments, c.superQualifierSymbol )
1748
1757
}
1749
1758
1750
1759
fun extractSpecialEnumFunction (fnName : String ){
@@ -3066,6 +3075,17 @@ open class KotlinFileExtractor(
3066
3075
}
3067
3076
}
3068
3077
3078
+ private fun extractSuperAccess (irType : IrType , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >, locId : Label <out DbLocation >) =
3079
+ tw.getFreshIdLabel<DbSuperaccess >().also {
3080
+ val type = useType(irType)
3081
+ tw.writeExprs_superaccess(it, type.javaResult.id, parent, idx)
3082
+ tw.writeExprsKotlinType(it, type.kotlinResult.id)
3083
+ tw.writeHasLocation(it, locId)
3084
+ tw.writeCallableEnclosingExpr(it, callable)
3085
+ tw.writeStatementEnclosingExpr(it, enclosingStmt)
3086
+ extractTypeAccessRecursive(irType, locId, it, 0 )
3087
+ }
3088
+
3069
3089
private fun extractThisAccess (e : IrGetValue , exprParent : ExprParent , callable : Label <out DbCallable >) {
3070
3090
val containingDeclaration = declarationStack.peek()
3071
3091
val locId = tw.getLocation(e)
@@ -4020,7 +4040,7 @@ open class KotlinFileExtractor(
4020
4040
/* *
4021
4041
* Extracts a single wildcard type access expression with no enclosing callable and statement.
4022
4042
*/
4023
- private fun extractWildcardTypeAccess (type : TypeResults , location : Label <DbLocation >, parent : Label <out DbExprparent >, idx : Int ): Label <out DbExpr > {
4043
+ private fun extractWildcardTypeAccess (type : TypeResults , location : Label <out DbLocation >, parent : Label <out DbExprparent >, idx : Int ): Label <out DbExpr > {
4024
4044
val id = tw.getFreshIdLabel<DbWildcardtypeaccess >()
4025
4045
tw.writeExprs_wildcardtypeaccess(id, type.javaResult.id, parent, idx)
4026
4046
tw.writeExprsKotlinType(id, type.kotlinResult.id)
@@ -4031,7 +4051,7 @@ open class KotlinFileExtractor(
4031
4051
/* *
4032
4052
* Extracts a single type access expression with no enclosing callable and statement.
4033
4053
*/
4034
- private fun extractTypeAccess (type : TypeResults , location : Label <DbLocation >, parent : Label <out DbExprparent >, idx : Int ): Label <out DbExpr > {
4054
+ private fun extractTypeAccess (type : TypeResults , location : Label <out DbLocation >, parent : Label <out DbExprparent >, idx : Int ): Label <out DbExpr > {
4035
4055
// TODO: elementForLocation allows us to give some sort of
4036
4056
// location, but a proper location for the type access will
4037
4057
// require upstream changes
@@ -4057,7 +4077,7 @@ open class KotlinFileExtractor(
4057
4077
* `extractTypeAccessRecursive` if the argument is invariant.
4058
4078
* No enclosing callable and statement is extracted, this is useful for type access extraction in field declarations.
4059
4079
*/
4060
- private fun extractWildcardTypeAccessRecursive (t : IrTypeArgument , location : Label <DbLocation >, parent : Label <out DbExprparent >, idx : Int ) {
4080
+ private fun extractWildcardTypeAccessRecursive (t : IrTypeArgument , location : Label <out DbLocation >, parent : Label <out DbExprparent >, idx : Int ) {
4061
4081
val typeLabels by lazy { TypeResults (getTypeArgumentLabel(t), TypeResult (fakeKotlinType(), " TODO" , " TODO" )) }
4062
4082
when (t) {
4063
4083
is IrStarProjection -> extractWildcardTypeAccess(typeLabels, location, parent, idx)
@@ -4077,7 +4097,7 @@ open class KotlinFileExtractor(
4077
4097
* Extracts a type access expression and its child type access expressions in case of a generic type. Nested generics are also handled.
4078
4098
* No enclosing callable and statement is extracted, this is useful for type access extraction in field declarations.
4079
4099
*/
4080
- private fun extractTypeAccessRecursive (t : IrType , location : Label <DbLocation >, parent : Label <out DbExprparent >, idx : Int , typeContext : TypeContext = TypeContext .OTHER ): Label <out DbExpr > {
4100
+ private fun extractTypeAccessRecursive (t : IrType , location : Label <out DbLocation >, parent : Label <out DbExprparent >, idx : Int , typeContext : TypeContext = TypeContext .OTHER ): Label <out DbExpr > {
4081
4101
val typeAccessId = extractTypeAccess(useType(t, typeContext), location, parent, idx)
4082
4102
if (t is IrSimpleType ) {
4083
4103
t.arguments.forEachIndexed { argIdx, arg ->
0 commit comments