@@ -113,7 +113,7 @@ open class KotlinFileExtractor(
113113 is IrFunction -> {
114114 val parentId = useDeclarationParent(declaration.parent, false )?.cast<DbReftype >()
115115 if (parentId != null ) {
116- extractFunction(declaration, parentId, extractFunctionBodies, null , listOf ())
116+ extractFunction(declaration, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, null , listOf ())
117117 }
118118 Unit
119119 }
@@ -123,7 +123,7 @@ open class KotlinFileExtractor(
123123 is IrProperty -> {
124124 val parentId = useDeclarationParent(declaration.parent, false )?.cast<DbReftype >()
125125 if (parentId != null ) {
126- extractProperty(declaration, parentId, true , null , listOf ())
126+ extractProperty(declaration, parentId, extractBackingField = true , extractFunctionBodies = extractFunctionBodies , null , listOf ())
127127 }
128128 Unit
129129 }
@@ -350,8 +350,8 @@ open class KotlinFileExtractor(
350350 c.declarations.map {
351351 if (shouldExtractDecl(it, false )) {
352352 when (it) {
353- is IrFunction -> extractFunction(it, id, false , typeParamSubstitution, argsIncludingOuterClasses)
354- is IrProperty -> extractProperty(it, id, false , typeParamSubstitution, argsIncludingOuterClasses)
353+ is IrFunction -> extractFunction(it, id, extractBody = false , extractMethodAndParameterTypeAccesses = false , typeParamSubstitution, argsIncludingOuterClasses)
354+ is IrProperty -> extractProperty(it, id, extractBackingField = false , extractFunctionBodies = false , typeParamSubstitution, argsIncludingOuterClasses)
355355 else -> {}
356356 }
357357 }
@@ -680,7 +680,7 @@ open class KotlinFileExtractor(
680680 }
681681 }
682682
683- fun extractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? , idOverride : Label <DbMethod >? = null): Label <out DbCallable >? {
683+ fun extractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , extractMethodAndParameterTypeAccesses : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? , idOverride : Label <DbMethod >? = null): Label <out DbCallable >? {
684684 if (isFake(f)) return null
685685
686686 with (" function" , f) {
@@ -706,13 +706,13 @@ open class KotlinFileExtractor(
706706 val extReceiver = f.extensionReceiverParameter
707707 val idxOffset = if (extReceiver != null ) 1 else 0
708708 val paramTypes = f.valueParameters.mapIndexed { i, vp ->
709- extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractBody )
709+ extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses )
710710 }
711711 val allParamTypes = if (extReceiver != null ) {
712712 val extendedType = useType(extReceiver.type)
713713 tw.writeKtExtensionFunctions(id.cast<DbMethod >(), extendedType.javaResult.id, extendedType.kotlinResult.id)
714714
715- val t = extractValueParameter(extReceiver, id, 0 , null , sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractBody )
715+ val t = extractValueParameter(extReceiver, id, 0 , null , sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses )
716716 listOf (t) + paramTypes
717717 } else {
718718 paramTypes
@@ -741,7 +741,7 @@ open class KotlinFileExtractor(
741741 tw.writeMethods(methodId, shortName.nameInDB, " ${shortName.nameInDB}$paramsSignature " , returnType.javaResult.id, parentId, sourceDeclaration.cast<DbMethod >())
742742 tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id)
743743
744- if (extractBody ) {
744+ if (extractMethodAndParameterTypeAccesses ) {
745745 extractTypeAccessRecursive(f.returnType, locId, id, - 1 )
746746 }
747747
@@ -808,7 +808,7 @@ open class KotlinFileExtractor(
808808 return id
809809 }
810810
811- fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) {
811+ fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , extractFunctionBodies : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) {
812812 with (" property" , p) {
813813 if (isFake(p)) return
814814
@@ -824,7 +824,7 @@ open class KotlinFileExtractor(
824824 val setter = p.setter
825825
826826 if (getter != null ) {
827- val getterId = extractFunction(getter, parentId, extractBackingField , typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast<DbMethod >()
827+ val getterId = extractFunction(getter, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies , typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast<DbMethod >()
828828 if (getterId != null ) {
829829 tw.writeKtPropertyGetters(id, getterId)
830830 }
@@ -838,7 +838,7 @@ open class KotlinFileExtractor(
838838 if (! p.isVar) {
839839 logger.errorElement(" !isVar property with a setter" , p)
840840 }
841- val setterId = extractFunction(setter, parentId, extractBackingField , typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast<DbMethod >()
841+ val setterId = extractFunction(setter, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies , typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast<DbMethod >()
842842 if (setterId != null ) {
843843 tw.writeKtPropertySetters(id, setterId)
844844 }
@@ -4015,7 +4015,7 @@ open class KotlinFileExtractor(
40154015 helper.extractParameterToFieldAssignmentInConstructor(" <fn>" , functionType, fieldId, 0 , 1 )
40164016
40174017 // add implementation function
4018- extractFunction(samMember, classId, false , null , null , ids.function)
4018+ extractFunction(samMember, classId, extractBody = false , extractMethodAndParameterTypeAccesses = true , null , null , ids.function)
40194019
40204020 // body
40214021 val blockId = tw.getFreshIdLabel<DbBlock >()
@@ -4191,7 +4191,7 @@ open class KotlinFileExtractor(
41914191 val id = extractGeneratedClass(ids, superTypes, tw.getLocation(localFunction), localFunction)
41924192
41934193 // Extract local function as a member
4194- extractFunction(localFunction, id, true , null , listOf ())
4194+ extractFunction(localFunction, id, extractBody = true , extractMethodAndParameterTypeAccesses = true , null , listOf ())
41954195
41964196 return id
41974197 }
0 commit comments