Don't try to assign comments to fake overrides

This commit is contained in:
Chris Smowton
2022-03-18 12:15:26 +00:00
committed by Ian Lynagh
parent 613e6b29a9
commit 8d6ae50d21

View File

@@ -3,7 +3,9 @@ package com.github.codeql.utils
import com.github.codeql.utils.versions.Psi2Ir
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.util.isFakeOverride
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrVisitorLookup(private val psi: PsiElement, private val file: IrFile) :
@@ -18,6 +20,12 @@ class IrVisitorLookup(private val psi: PsiElement, private val file: IrFile) :
return
}
if (element is IrDeclaration && element.isFakeOverride) {
// These aren't extracted, so we don't expect anything to exist
// to which we could ascribe a comment.
return
}
if (location.contains(elementLocation)) {
val psiElement = Psi2Ir().findPsiElement(element, file)
if (psiElement == psi) {