mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Add QL for ::class expression, and add test
This commit is contained in:
@@ -2143,9 +2143,7 @@ class WhenExpr extends Expr, @whenexpr {
|
||||
override string getAPrimaryQlClass() { result = "WhenExpr" }
|
||||
|
||||
/** Gets the `i`th branch. */
|
||||
WhenBranch getBranch(int i) {
|
||||
when_branch(result, this, i)
|
||||
}
|
||||
WhenBranch getBranch(int i) { when_branch(result, this, i) }
|
||||
}
|
||||
|
||||
/** A Kotlin `when` branch. */
|
||||
@@ -2163,3 +2161,13 @@ class WhenBranch extends Top, @whenbranch {
|
||||
|
||||
override string getAPrimaryQlClass() { result = "WhenBranch" }
|
||||
}
|
||||
|
||||
/** A Kotlin `::class` expression. */
|
||||
class ClassExpr extends Expr, @getclassexpr {
|
||||
/** Gets the expression whose class is being returned. */
|
||||
Expr getExpr() { result.isNthChildOf(this, 0) }
|
||||
|
||||
override string toString() { result = "::class" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ClassExpr" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user