mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Don't try to attribute comments to the implicit this parameter.
This commit is contained in:
committed by
Ian Lynagh
parent
6abb2529f5
commit
48b99cf55c
@@ -8,6 +8,7 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.path
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtVisitor
|
||||
@@ -93,6 +94,10 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
|
||||
if (ownerIr == file)
|
||||
fileLabel
|
||||
else {
|
||||
if (ownerIr is IrValueParameter && ownerIr.index == -1) {
|
||||
// Don't attribute comments to the implicit `this` parameter of a function.
|
||||
continue
|
||||
}
|
||||
val label = fileExtractor.getLabel(ownerIr) ?: continue
|
||||
val existingLabel = tw.getExistingLabelFor<DbTop>(label)
|
||||
if (existingLabel == null) {
|
||||
|
||||
Reference in New Issue
Block a user