Skip to content

Commit 2713b3e

Browse files
committed
Comment extraction: don't treat anonymous classes differently
1 parent ecb3788 commit 2713b3e

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,6 @@ open class KotlinUsesExtractor(
470470
)
471471
}
472472

473-
fun getExistingAnonymousClassLabel(c: IrClass): Label<out DbType>? {
474-
if (!c.isAnonymousObject){
475-
return null
476-
}
477-
478-
return tw.lm.anonymousTypeMapping[c]?.javaResult?.id
479-
}
480-
481473
fun fakeKotlinType(): Label<out DbKt_type> {
482474
val fakeKotlinPackageId: Label<DbPackage> = tw.getLabelFor("@\"FakeKotlinPackage\"", {
483475
tw.writePackages(it, "fake.kotlin")

java/kotlin-extractor/src/main/kotlin/comments/CommentExtractor.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
127127
// local functions are not named globally, so we need to get them from the local function label cache
128128
label = "local function ${element.name.asString()}"
129129
fileExtractor.getExistingLocallyVisibleFunctionLabel(element)
130-
} else if (element is IrClass && element.isAnonymousObject) {
131-
// anonymous objects are not named globally, so we need to get them from the cache
132-
label = "anonymous class ${element.name.asString()}"
133-
fileExtractor.getExistingAnonymousClassLabel(element)
134-
}
135-
else {
130+
} else {
136131
label = getLabelForNamedElement(element) ?: return null
137132
tw.getExistingLabelFor<DbTop>(label)
138133
}
@@ -145,12 +140,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
145140

146141
private fun getLabelForNamedElement(element: IrElement) : String? {
147142
when (element) {
148-
is IrClass ->
149-
return if (element.isAnonymousObject) {
150-
null
151-
} else {
152-
fileExtractor.getClassLabel(element, listOf()).classLabel
153-
}
143+
is IrClass -> return fileExtractor.getClassLabel(element, listOf()).classLabel
154144
is IrTypeParameter -> return fileExtractor.getTypeParameterLabel(element)
155145
is IrFunction -> {
156146
return if (element.isLocalFunction()) {

0 commit comments

Comments
 (0)