Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48b99cf

Browse files
smowtonigfoo
authored andcommitted
Don't try to attribute comments to the implicit this parameter.
1 parent 6abb252 commit 48b99cf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

java/kotlin-extractor/src/main/kotlin/comments/CommentExtractor.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.intellij.psi.PsiElement
88
import org.jetbrains.kotlin.ir.IrElement
99
import org.jetbrains.kotlin.ir.declarations.path
1010
import org.jetbrains.kotlin.ir.declarations.IrFile
11+
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
1112
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
1213
import org.jetbrains.kotlin.lexer.KtTokens
1314
import org.jetbrains.kotlin.psi.KtVisitor
@@ -93,6 +94,10 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
9394
if (ownerIr == file)
9495
fileLabel
9596
else {
97+
if (ownerIr is IrValueParameter && ownerIr.index == -1) {
98+
// Don't attribute comments to the implicit `this` parameter of a function.
99+
continue
100+
}
96101
val label = fileExtractor.getLabel(ownerIr) ?: continue
97102
val existingLabel = tw.getExistingLabelFor<DbTop>(label)
98103
if (existingLabel == null) {

0 commit comments

Comments
 (0)