mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Merge pull request #10268 from tamasvajk/kotlin-local-function-comments
Kotlin: fix doc comment extraction for local functions
This commit is contained in:
@@ -7,9 +7,13 @@ comments
|
||||
| comments.kt:28:5:30:6 | /*\n A block comment\n */ | /*\n A block comment\n */ |
|
||||
| comments.kt:35:5:35:34 | /** Medium is in the middle */ | /** Medium is in the middle */ |
|
||||
| comments.kt:37:5:37:23 | /** This is high */ | /** This is high */ |
|
||||
| comments.kt:42:5:44:6 | /**\n * A variable.\n */ | /**\n * A variable.\n */ |
|
||||
| comments.kt:42:5:44:7 | /**\n * A variable.\n */ | /**\n * A variable.\n */ |
|
||||
| comments.kt:48:1:50:3 | /**\n * A type alias comment\n */ | /**\n * A type alias comment\n */ |
|
||||
| comments.kt:54:5:56:7 | /**\n * An init block comment\n */ | /**\n * An init block comment\n */ |
|
||||
| comments.kt:61:5:63:7 | /**\n * A prop comment\n */ | /**\n * A prop comment\n */ |
|
||||
| comments.kt:65:9:67:11 | /**\n * An accessor comment\n */ | /**\n * An accessor comment\n */ |
|
||||
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | /**\n * An anonymous function comment\n */ |
|
||||
| comments.kt:79:9:81:11 | /**\n * A local function comment\n */ | /**\n * A local function comment\n */ |
|
||||
commentOwners
|
||||
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:31:1 | Group |
|
||||
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:31:1 | Group |
|
||||
@@ -19,9 +23,19 @@ commentOwners
|
||||
| comments.kt:19:5:22:7 | /**\n * Adds a [member] to this group.\n * @return the new size of the group.\n */ | comments.kt:23:5:26:5 | add |
|
||||
| comments.kt:35:5:35:34 | /** Medium is in the middle */ | comments.kt:36:5:36:14 | Medium |
|
||||
| comments.kt:37:5:37:23 | /** This is high */ | comments.kt:38:5:38:11 | High |
|
||||
| comments.kt:42:5:44:6 | /**\n * A variable.\n */ | comments.kt:45:5:45:13 | int a |
|
||||
| comments.kt:42:5:44:7 | /**\n * A variable.\n */ | comments.kt:45:5:45:13 | int a |
|
||||
| comments.kt:48:1:50:3 | /**\n * A type alias comment\n */ | comments.kt:51:1:51:24 | MyType |
|
||||
| comments.kt:54:5:56:7 | /**\n * An init block comment\n */ | comments.kt:53:1:58:1 | InitBlock |
|
||||
| comments.kt:61:5:63:7 | /**\n * A prop comment\n */ | comments.kt:64:5:68:17 | prop |
|
||||
| comments.kt:65:9:67:11 | /**\n * An accessor comment\n */ | comments.kt:68:9:68:17 | getProp |
|
||||
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | comments.kt:70:5:76:10 | getL |
|
||||
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | comments.kt:70:5:76:10 | l |
|
||||
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | comments.kt:70:5:76:10 | l |
|
||||
| comments.kt:79:9:81:11 | /**\n * A local function comment\n */ | comments.kt:82:9:82:24 | localFn |
|
||||
commentNoOwners
|
||||
| comments.kt:1:1:1:25 | /** Kdoc with no owner */ |
|
||||
| comments.kt:24:9:24:25 | // A line comment |
|
||||
| comments.kt:28:5:30:6 | /*\n A block comment\n */ |
|
||||
commentSections
|
||||
| comments.kt:1:1:1:25 | /** Kdoc with no owner */ | Kdoc with no owner |
|
||||
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | A group of *members*.\n\nThis class has no useful logic; it's just a documentation example.\n\n |
|
||||
@@ -31,14 +45,22 @@ commentSections
|
||||
| comments.kt:19:5:22:7 | /**\n * Adds a [member] to this group.\n * @return the new size of the group.\n */ | Adds a [member] to this group.\n |
|
||||
| comments.kt:35:5:35:34 | /** Medium is in the middle */ | Medium is in the middle |
|
||||
| comments.kt:37:5:37:23 | /** This is high */ | This is high |
|
||||
| comments.kt:42:5:44:6 | /**\n * A variable.\n */ | A variable. |
|
||||
| comments.kt:42:5:44:7 | /**\n * A variable.\n */ | A variable. |
|
||||
| comments.kt:48:1:50:3 | /**\n * A type alias comment\n */ | A type alias comment |
|
||||
| comments.kt:54:5:56:7 | /**\n * An init block comment\n */ | An init block comment |
|
||||
| comments.kt:61:5:63:7 | /**\n * A prop comment\n */ | A prop comment |
|
||||
| comments.kt:65:9:67:11 | /**\n * An accessor comment\n */ | An accessor comment |
|
||||
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | An anonymous function comment |
|
||||
| comments.kt:79:9:81:11 | /**\n * A local function comment\n */ | A local function comment |
|
||||
commentSectionContents
|
||||
| A group of *members*.\n\nThis class has no useful logic; it's just a documentation example.\n\n | A group of *members*.\n\nThis class has no useful logic; it's just a documentation example.\n\n |
|
||||
| A local function comment | A local function comment |
|
||||
| A prop comment | A prop comment |
|
||||
| A type alias comment | A type alias comment |
|
||||
| A variable. | A variable. |
|
||||
| Adds a [member] to this group.\n | Adds a [member] to this group.\n |
|
||||
| An accessor comment | An accessor comment |
|
||||
| An anonymous function comment | An anonymous function comment |
|
||||
| An init block comment | An init block comment |
|
||||
| Creates an empty group. | Creates an empty group. |
|
||||
| Kdoc with no owner | Kdoc with no owner |
|
||||
|
||||
@@ -41,7 +41,7 @@ enum class Severity(val sev: Int) {
|
||||
fun fn1() {
|
||||
/**
|
||||
* A variable.
|
||||
*/
|
||||
*/
|
||||
val a = 1
|
||||
}
|
||||
|
||||
@@ -56,3 +56,29 @@ class InitBlock {
|
||||
*/
|
||||
init { }
|
||||
}
|
||||
|
||||
class X {
|
||||
/**
|
||||
* A prop comment
|
||||
*/
|
||||
val prop: Int
|
||||
/**
|
||||
* An accessor comment
|
||||
*/
|
||||
get() = 5
|
||||
|
||||
val l: Lazy<Int> = lazy(
|
||||
/**
|
||||
* An anonymous function comment
|
||||
*/
|
||||
fun(): Int {
|
||||
return 5
|
||||
})
|
||||
|
||||
fun fn() {
|
||||
/**
|
||||
* A local function comment
|
||||
*/
|
||||
fun localFn() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ query predicate comments(KtComment c, string s) { c.getText() = s }
|
||||
|
||||
query predicate commentOwners(KtComment c, Top t) { c.getOwner() = t }
|
||||
|
||||
query predicate commentNoOwners(KtComment c) { not exists(c.getOwner()) }
|
||||
|
||||
query predicate commentSections(KtComment c, KtCommentSection s) { c.getSections() = s }
|
||||
|
||||
query predicate commentSectionContents(KtCommentSection s, string c) { s.getContent() = c }
|
||||
|
||||
Reference in New Issue
Block a user