Merge pull request #10268 from tamasvajk/kotlin-local-function-comments

Kotlin: fix doc comment extraction for local functions
This commit is contained in:
Ian Lynagh
2022-09-05 13:35:01 +01:00
committed by GitHub
6 changed files with 115 additions and 35 deletions

View File

@@ -1140,10 +1140,6 @@ open class KotlinUsesExtractor(
// Note not using `parentsWithSelf` as that only works if `d` is an IrDeclarationParent
d.parents.any { (it as? IrAnnotationContainer)?.hasAnnotation(jvmWildcardSuppressionAnnotaton) == true }
protected fun IrFunction.isLocalFunction(): Boolean {
return this.visibility == DescriptorVisibilities.LOCAL
}
/**
* Class to hold labels for generated classes around local functions, lambdas, function references, and property references.
*/
@@ -1185,6 +1181,14 @@ open class KotlinUsesExtractor(
return res
}
fun getExistingLocallyVisibleFunctionLabel(f: IrFunction): Label<DbMethod>? {
if (!f.isLocalFunction()){
return null
}
return tw.lm.locallyVisibleFunctionLabelMapping[f]?.function
}
// These are classes with Java equivalents, but whose methods don't all exist on those Java equivalents--
// for example, the numeric classes define arithmetic functions (Int.plus, Long.or and so on) that lower to
// primitive arithmetic on the JVM, but which we extract as calls to reflect the source syntax more closely.