mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Extract not-null expression
This commit is contained in:
@@ -695,6 +695,7 @@ case @expr.kind of
|
||||
| 79 = @stmtexpr
|
||||
| 80 = @stringtemplateexpr
|
||||
| 81 = @varargexpr
|
||||
| 82 = @notnullexpr
|
||||
;
|
||||
|
||||
/** Holds if this `when` expression was written as an `if` expression. */
|
||||
@@ -771,7 +772,8 @@ when_branch_else(unique int id: @whenbranch ref);
|
||||
| @minusexpr
|
||||
| @plusexpr
|
||||
| @bitnotexpr
|
||||
| @lognotexpr;
|
||||
| @lognotexpr
|
||||
| @notnullexpr;
|
||||
|
||||
@caller = @classinstancexpr
|
||||
| @methodaccess
|
||||
|
||||
@@ -1463,9 +1463,7 @@ class InstanceOfExpr extends Expr, @instanceofexpr {
|
||||
/** An `instanceof` expression. */
|
||||
class NotInstanceOfExpr extends Expr, @notinstanceofexpr {
|
||||
/** Gets the expression on the left-hand side of the `!is` operator. */
|
||||
Expr getExpr() {
|
||||
result.isNthChildOf(this, 0)
|
||||
}
|
||||
Expr getExpr() { result.isNthChildOf(this, 0) }
|
||||
|
||||
/** Gets the access to the type on the right-hand side of the `!is` operator. */
|
||||
Expr getTypeName() { result.isNthChildOf(this, 1) }
|
||||
@@ -2195,19 +2193,13 @@ class WhenBranch extends Top, @whenbranch {
|
||||
Expr getCondition() { result.isNthChildOf(this, 0) }
|
||||
|
||||
/** Gets the result of this branch. */
|
||||
Stmt getRhs() {
|
||||
result.isNthChildOf(this, 1)
|
||||
}
|
||||
Stmt getRhs() { result.isNthChildOf(this, 1) }
|
||||
|
||||
/** Gets a result expression of this `when` branch. */
|
||||
Expr getAResult() {
|
||||
result = getAResult(this.getRhs())
|
||||
}
|
||||
Expr getAResult() { result = getAResult(this.getRhs()) }
|
||||
|
||||
/** Holds if this is an `else` branch. */
|
||||
predicate isElseBranch() {
|
||||
when_branch_else(this)
|
||||
}
|
||||
predicate isElseBranch() { when_branch_else(this) }
|
||||
|
||||
override string toString() { result = "... -> ..." }
|
||||
|
||||
@@ -2290,3 +2282,10 @@ class VarArgExpr extends Expr, @varargexpr {
|
||||
|
||||
override string getAPrimaryQlClass() { result = "VarArgExpr" }
|
||||
}
|
||||
|
||||
/** A Kotlin not-null expression. For example, `expr!!`. */
|
||||
class NotNullExpr extends UnaryExpr, @notnullexpr {
|
||||
override string toString() { result = "...!!" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "NotNullExpr" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user