mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Merge pull request #14940 from igfoo/igfoo/comments
Kotlin 2: Comment improvements
This commit is contained in:
@@ -205,7 +205,7 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
private fun isFake(d: IrDeclarationWithVisibility): Boolean {
|
||||
fun isFake(d: IrDeclarationWithVisibility): Boolean {
|
||||
val hasFakeVisibility =
|
||||
d.visibility.let {
|
||||
it is DelegatedDescriptorVisibility && it.delegate == Visibilities.InvisibleFake
|
||||
|
||||
@@ -41,7 +41,13 @@ open class CommentExtractor(
|
||||
tw.getExistingLabelFor<DbTop>(label)
|
||||
}
|
||||
if (existingLabel == null) {
|
||||
logger.warn("Couldn't get existing label for $label")
|
||||
// Sometimes we don't extract elements.
|
||||
// The actual extractor logic is a bit more nuanced than
|
||||
// just "isFake", but just checking isFake is good enough
|
||||
// to not bother with a warning.
|
||||
if (element !is IrDeclarationWithVisibility || !fileExtractor.isFake(element)) {
|
||||
logger.warn("Couldn't get existing label for $label")
|
||||
}
|
||||
return null
|
||||
}
|
||||
return existingLabel
|
||||
|
||||
@@ -15,6 +15,9 @@ import org.jetbrains.kotlin.kdoc.lexer.KDocTokens
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.util.getChildren
|
||||
|
||||
// TODO: This doesn't give owners to as many comments as the PSI extractor does.
|
||||
// See the library-tests/comments tests for details.
|
||||
|
||||
class CommentExtractorLighterAST(
|
||||
fileExtractor: KotlinFileExtractor,
|
||||
file: IrFile,
|
||||
|
||||
Reference in New Issue
Block a user