Only get existing local function labels

This commit is contained in:
Tamas Vajk
2022-09-05 09:16:23 +02:00
parent c77f573a8e
commit 81cf4c39f4
2 changed files with 9 additions and 1 deletions

View File

@@ -1162,6 +1162,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.

View File

@@ -107,7 +107,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
tw.getExistingVariableLabelFor(ownerIr)
} else if (ownerIr is IrFunction && ownerIr.isLocalFunction()) {
label = "local function ${ownerIr.name.asString()}"
fileExtractor.getLocallyVisibleFunctionLabels(ownerIr).function
fileExtractor.getExistingLocallyVisibleFunctionLabel(ownerIr)
}
else {
label = getLabel(ownerIr) ?: continue