Add QL for ::class expression, and add test

This commit is contained in:
Tamas Vajk
2021-09-21 11:25:22 +02:00
committed by Ian Lynagh
parent e8a079b56a
commit 9889f49560
3 changed files with 17 additions and 3 deletions

View File

@@ -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" }
}