Skip to content

Commit c961a31

Browse files
committed
Java: Add Expr.getAnEnclosingStmt.
1 parent 5e021c2 commit c961a31

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ class Expr extends ExprParent, @expr {
6060
/** Gets the statement containing this expression, if any. */
6161
Stmt getEnclosingStmt() { statementEnclosingExpr(this, result) }
6262

63+
/**
64+
* Gets a statement that transitively contains this expression, if any.
65+
* This is equivalent to `this.getEnclosingStmt().getEnclosingStmt*()`.
66+
*/
67+
Stmt getAnEnclosingStmt() { result = this.getEnclosingStmt().getEnclosingStmt*() }
68+
6369
/** Gets a child of this expression. */
6470
Expr getAChildExpr() { exprs(result, _, _, this, _) }
6571

0 commit comments

Comments
 (0)