Skip to content

Commit 2116e6d

Browse files
committed
Java: Add ErrorExpr, ErrorStmt
1 parent 0575818 commit 2116e6d

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

java/ql/lib/config/semmlecode.dbscheme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ case @stmt.kind of
528528
| 21 = @case
529529
| 22 = @catchclause
530530
| 23 = @yieldstmt
531+
| 24 = @errorstmt
531532
;
532533

533534
#keyset[parent,idx]
@@ -628,6 +629,7 @@ case @expr.kind of
628629
| 71 = @typeannotation
629630
| 72 = @intersectiontypeaccess
630631
| 73 = @switchexpr
632+
| 74 = @errorexpr
631633
;
632634

633635
@classinstancexpr = @newexpr | @lambdaexpr | @memberref

java/ql/lib/semmle/code/java/Expr.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,18 @@ class CompileTimeConstantExpr extends Expr {
377377
/** An expression parent is an element that may have an expression as its child. */
378378
class ExprParent extends @exprparent, Top { }
379379

380+
/**
381+
* An error expression.
382+
*
383+
* These may be generated by upgrade or downgrade scripts when databases
384+
* cannot be fully converted.
385+
*/
386+
class ErrorExpr extends Expr, @errorexpr {
387+
override string toString() { result = "<error expr>" }
388+
389+
override string getAPrimaryQlClass() { result = "ErrorExpr" }
390+
}
391+
380392
/**
381393
* An array access.
382394
*

java/ql/lib/semmle/code/java/Statement.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ class Stmt extends StmtParent, ExprParent, @stmt {
5959
/** A statement parent is any element that can have a statement as its child. */
6060
class StmtParent extends @stmtparent, Top { }
6161

62+
/**
63+
* An error statement.
64+
*
65+
* These may be generated by upgrade or downgrade scripts when databases
66+
* cannot be fully converted.
67+
*/
68+
class ErrorStmt extends Stmt, @errorstmt {
69+
override string toString() { result = "<error stmt>" }
70+
71+
override string getAPrimaryQlClass() { result = "ErrorStmt" }
72+
}
73+
6274
/** A block of statements. */
6375
class BlockStmt extends Stmt, @block {
6476
/** Gets a statement that is an immediate child of this block. */

0 commit comments

Comments
 (0)