[psi] decompiled code doesn't have documentation

otherwise AST for decompiled code would be loaded by allChildren call

^ KTIJ-25047
This commit is contained in:
Anna Kozlova
2023-05-12 08:55:00 +02:00
committed by teamcity
parent 72f30d78d6
commit 360e7d6156
@@ -19,9 +19,15 @@ package org.jetbrains.kotlin.psi.findDocComment
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtDeclarationModifierList
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.psiUtil.allChildren
fun findDocComment(declaration: KtDeclaration): KDoc? {
val containingFile = declaration.containingFile
if (containingFile is KtFile && containingFile.isCompiled) {
//can't use containingKtFile due to non-physical code fragments, e.g. ssr
return null
}
return declaration.allChildren
.flatMap {
if (it is KtDeclarationModifierList) {