@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.ir.IrElement
10
10
import org.jetbrains.kotlin.ir.declarations.*
11
11
import org.jetbrains.kotlin.ir.expressions.IrBody
12
12
import org.jetbrains.kotlin.ir.expressions.IrExpression
13
+ import org.jetbrains.kotlin.ir.util.isAnonymousObject
13
14
import org.jetbrains.kotlin.ir.util.parentClassOrNull
14
15
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
15
16
import org.jetbrains.kotlin.lexer.KtTokens
@@ -126,6 +127,10 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
126
127
// local functions are not named globally, so we need to get them from the local function label cache
127
128
label = " local function ${element.name.asString()} "
128
129
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)
129
134
}
130
135
else {
131
136
label = getLabelForNamedElement(element) ? : return null
@@ -140,7 +145,12 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
140
145
141
146
private fun getLabelForNamedElement (element : IrElement ) : String? {
142
147
when (element) {
143
- is IrClass -> return fileExtractor.getClassLabel(element, listOf ()).classLabel
148
+ is IrClass ->
149
+ return if (element.isAnonymousObject) {
150
+ null
151
+ } else {
152
+ fileExtractor.getClassLabel(element, listOf ()).classLabel
153
+ }
144
154
is IrTypeParameter -> return fileExtractor.getTypeParameterLabel(element)
145
155
is IrFunction -> {
146
156
return if (element.isLocalFunction()) {
0 commit comments