Comment extraction: don't treat anonymous classes differently

This commit is contained in:
Chris Smowton
2022-10-18 11:10:29 +01:00
parent ecb3788467
commit 2713b3ee06
2 changed files with 2 additions and 20 deletions

View File

@@ -470,14 +470,6 @@ open class KotlinUsesExtractor(
)
}
fun getExistingAnonymousClassLabel(c: IrClass): Label<out DbType>? {
if (!c.isAnonymousObject){
return null
}
return tw.lm.anonymousTypeMapping[c]?.javaResult?.id
}
fun fakeKotlinType(): Label<out DbKt_type> {
val fakeKotlinPackageId: Label<DbPackage> = tw.getLabelFor("@\"FakeKotlinPackage\"", {
tw.writePackages(it, "fake.kotlin")

View File

@@ -127,12 +127,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
// local functions are not named globally, so we need to get them from the local function label cache
label = "local function ${element.name.asString()}"
fileExtractor.getExistingLocallyVisibleFunctionLabel(element)
} else if (element is IrClass && element.isAnonymousObject) {
// anonymous objects are not named globally, so we need to get them from the cache
label = "anonymous class ${element.name.asString()}"
fileExtractor.getExistingAnonymousClassLabel(element)
}
else {
} else {
label = getLabelForNamedElement(element) ?: return null
tw.getExistingLabelFor<DbTop>(label)
}
@@ -145,12 +140,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
private fun getLabelForNamedElement(element: IrElement) : String? {
when (element) {
is IrClass ->
return if (element.isAnonymousObject) {
null
} else {
fileExtractor.getClassLabel(element, listOf()).classLabel
}
is IrClass -> return fileExtractor.getClassLabel(element, listOf()).classLabel
is IrTypeParameter -> return fileExtractor.getTypeParameterLabel(element)
is IrFunction -> {
return if (element.isLocalFunction()) {