@@ -46,15 +46,15 @@ open class KotlinFileExtractor(
4646 is IrFunction -> {
4747 @Suppress(" UNCHECKED_CAST" )
4848 val parentId = useDeclarationParent(declaration.parent, false ) as Label <DbReftype >
49- extractFunctionIfReal(declaration, parentId)
49+ extractFunctionIfReal(declaration, parentId, true , null , listOf () )
5050 }
5151 is IrAnonymousInitializer -> {
5252 // Leaving this intentionally empty. init blocks are extracted during class extraction.
5353 }
5454 is IrProperty -> {
5555 @Suppress(" UNCHECKED_CAST" )
5656 val parentId = useDeclarationParent(declaration.parent, false ) as Label <DbReftype >
57- extractProperty(declaration, parentId)
57+ extractProperty(declaration, parentId, true , null , listOf () )
5858 }
5959 is IrEnumEntry -> {
6060 @Suppress(" UNCHECKED_CAST" )
@@ -216,8 +216,8 @@ open class KotlinFileExtractor(
216216
217217 c.declarations.map {
218218 when (it) {
219- is IrFunction -> extractFunctionIfReal(it, id, false , typeParamSubstitution)
220- is IrProperty -> extractProperty(it, id, false , typeParamSubstitution)
219+ is IrFunction -> extractFunctionIfReal(it, id, false , typeParamSubstitution, typeArgs )
220+ is IrProperty -> extractProperty(it, id, false , typeParamSubstitution, typeArgs )
221221 else -> {}
222222 }
223223 }
@@ -374,7 +374,7 @@ open class KotlinFileExtractor(
374374 }
375375
376376 // add method:
377- val obinitLabel = getFunctionLabel(c, " <obinit>" , listOf (), pluginContext.irBuiltIns.unitType, extensionReceiverParameter = null )
377+ val obinitLabel = getFunctionLabel(c, " <obinit>" , listOf (), pluginContext.irBuiltIns.unitType, extensionReceiverParameter = null , functionTypeParameters = listOf (), classTypeArguments = listOf () )
378378 val obinitId = tw.getLabelFor<DbMethod >(obinitLabel)
379379 val returnType = useType(pluginContext.irBuiltIns.unitType)
380380 tw.writeMethods(obinitId, " <obinit>" , " <obinit>()" , returnType.javaResult.id, returnType.kotlinResult.id, parentId, obinitId)
@@ -442,13 +442,13 @@ open class KotlinFileExtractor(
442442 }
443443 }
444444
445- fun extractFunctionIfReal (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean = true , typeSubstitution : TypeSubstitution ? = null ) {
445+ fun extractFunctionIfReal (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgs : List < IrTypeArgument > ? ) {
446446 if (f.origin == IrDeclarationOrigin .FAKE_OVERRIDE )
447447 return
448- extractFunction(f, parentId, extractBody, typeSubstitution)
448+ extractFunction(f, parentId, extractBody, typeSubstitution, classTypeArgs )
449449 }
450450
451- fun extractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean = true , typeSubstitution : TypeSubstitution ? = null ): Label <out DbCallable > {
451+ fun extractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgs : List < IrTypeArgument > ? ): Label <out DbCallable > {
452452 declarationStack.push(f)
453453
454454 f.typeParameters.map { extractTypeParameter(it) }
@@ -459,7 +459,7 @@ open class KotlinFileExtractor(
459459 if (f.isLocalFunction())
460460 getLocallyVisibleFunctionLabels(f).function
461461 else
462- useFunction<DbCallable >(f, parentId)
462+ useFunction<DbCallable >(f, parentId, classTypeArgs )
463463
464464 val extReceiver = f.extensionReceiverParameter
465465 val idxOffset = if (extReceiver != null ) 1 else 0
@@ -543,7 +543,7 @@ open class KotlinFileExtractor(
543543 return id
544544 }
545545
546- fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean = true , typeSubstitution : TypeSubstitution ? = null ) {
546+ fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgs : List < IrTypeArgument > ? ) {
547547 val id = useProperty(p, parentId)
548548 val locId = tw.getLocation(p)
549549 tw.writeKtProperties(id, p.name.asString())
@@ -555,7 +555,7 @@ open class KotlinFileExtractor(
555555
556556 if (getter != null ) {
557557 @Suppress(" UNCHECKED_CAST" )
558- val getterId = extractFunction(getter, parentId, extractBackingField, typeSubstitution) as Label <out DbMethod >
558+ val getterId = extractFunction(getter, parentId, extractBackingField, typeSubstitution, classTypeArgs ) as Label <out DbMethod >
559559 tw.writeKtPropertyGetters(id, getterId)
560560 } else {
561561 if (p.modality != Modality .FINAL || ! isExternalDeclaration(p)) {
@@ -568,7 +568,7 @@ open class KotlinFileExtractor(
568568 logger.warnElement(Severity .ErrorSevere , " !isVar property with a setter" , p)
569569 }
570570 @Suppress(" UNCHECKED_CAST" )
571- val setterId = extractFunction(setter, parentId, extractBackingField, typeSubstitution) as Label <out DbMethod >
571+ val setterId = extractFunction(setter, parentId, extractBackingField, typeSubstitution, classTypeArgs ) as Label <out DbMethod >
572572 tw.writeKtPropertySetters(id, setterId)
573573 } else {
574574 if (p.isVar && ! isExternalDeclaration(p)) {
@@ -1493,7 +1493,7 @@ open class KotlinFileExtractor(
14931493 val id = tw.getFreshIdLabel<DbMethodaccess >()
14941494 val type = useType(e.type)
14951495 val locId = tw.getLocation(e)
1496- val methodLabel = getFunctionLabel(irCallable.parent, " <obinit>" , listOf (), e.type, null )
1496+ val methodLabel = getFunctionLabel(irCallable.parent, " <obinit>" , listOf (), e.type, null , functionTypeParameters = listOf (), classTypeArguments = listOf () )
14971497 val methodId = tw.getLabelFor<DbMethod >(methodLabel)
14981498 tw.writeExprs_methodaccess(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
14991499 tw.writeHasLocation(id, locId)
@@ -2536,7 +2536,7 @@ open class KotlinFileExtractor(
25362536 val id = extractGeneratedClass(ids, superTypes, tw.getLocation(localFunction), localFunction)
25372537
25382538 // Extract local function as a member
2539- extractFunctionIfReal(localFunction, id)
2539+ extractFunctionIfReal(localFunction, id, true , null , listOf () )
25402540
25412541 return id
25422542 }
0 commit comments