mirror of
https://github.com/github/codeql.git
synced 2026-05-24 16:17:07 +02:00
Fix KE1
This commit is contained in:
@@ -6277,7 +6277,7 @@ open class KotlinFileExtractor(
|
||||
|
||||
val condId = tw.getFreshIdLabel<DbWhenbranchcondition>()
|
||||
tw.writeStmts_whenbranchcondition(condId, bId, 0, callable)
|
||||
tw.writeHasLocation(id, bLocId)
|
||||
tw.writeHasLocation(condId, bLocId)
|
||||
tw.writeWhen_branch_condition_with_expr(condId)
|
||||
extractExpressionExpr(b.condition, callable, condId, 0, condId)
|
||||
extractExpressionStmt(b.result, callable, bId, 1)
|
||||
|
||||
@@ -2624,6 +2624,10 @@ class WhenBranchConditionWithExpression extends WhenBranchCondition {
|
||||
|
||||
/** Gets the expression of this branch condition. */
|
||||
Expr getExpression() { result.isNthChildOf(this, 0) }
|
||||
|
||||
override string toString() { result = "... ->" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "WhenBranchConditionWithExpression" }
|
||||
}
|
||||
|
||||
/** A Kotlin `when` branch condition with a range. */
|
||||
@@ -2638,6 +2642,10 @@ class WhenBranchConditionWithRange extends WhenBranchCondition {
|
||||
* Ranges are represented by calls to `operator fun <T : Comparable<T>> T.rangeTo(that: T): ClosedRange<T>`.
|
||||
*/
|
||||
MethodCall getRange() { result.isNthChildOf(this, 0) }
|
||||
|
||||
override string toString() { result = "in ... ->" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "WhenBranchConditionWithRange" }
|
||||
}
|
||||
|
||||
/** A Kotlin `when` branch condition with a pattern. */
|
||||
@@ -2649,6 +2657,10 @@ class WhenBranchConditionWithPattern extends WhenBranchCondition {
|
||||
|
||||
/** Gets the type pattern of this branch condition. */
|
||||
Type getType() { when_branch_condition_with_pattern(this, _, result, _) }
|
||||
|
||||
override string toString() { result = "is ... ->" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "WhenBranchConditionWithPattern" }
|
||||
}
|
||||
|
||||
// TODO: This might need more cases. It might be better as a predicate
|
||||
|
||||
Reference in New Issue
Block a user