Skip to content

Commit 98d2410

Browse files
authored
Merge pull request github#3687 from aschackmull/java/getanenclosingstmt
Java: Add Expr.getAnEnclosingStmt.
2 parents 73d606d + 421a548 commit 98d2410

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 directly or 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)