@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.ir.IrElement
1010import org.jetbrains.kotlin.ir.declarations.*
1111import org.jetbrains.kotlin.ir.expressions.IrBody
1212import org.jetbrains.kotlin.ir.expressions.IrExpression
13+ import org.jetbrains.kotlin.ir.util.isAnonymousObject
1314import org.jetbrains.kotlin.ir.util.parentClassOrNull
1415import org.jetbrains.kotlin.kdoc.psi.api.KDoc
1516import org.jetbrains.kotlin.lexer.KtTokens
@@ -126,6 +127,10 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
126127 // local functions are not named globally, so we need to get them from the local function label cache
127128 label = " local function ${element.name.asString()} "
128129 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)
129134 }
130135 else {
131136 label = getLabelForNamedElement(element) ? : return null
@@ -140,7 +145,12 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
140145
141146 private fun getLabelForNamedElement (element : IrElement ) : String? {
142147 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+ }
144154 is IrTypeParameter -> return fileExtractor.getTypeParameterLabel(element)
145155 is IrFunction -> {
146156 return if (element.isLocalFunction()) {
0 commit comments