Description of the issue
Now and then I want to find out if a Stmt encloses (directly or transitively) an Expr.
Maybe I am missing something, but it appears doing this is rather verbose because it is not possible to use a transitive closure for Expr.getEnclosingStmt, so instead of
from Stmt stmt, Expr expr
where
expr.getEnclosingStmt+() = stmt
select stmt, expr
you have to write
from Stmt stmt, Expr expr
where
expr.getEnclosingStmt().getEnclosingStmt*() = stmt
select stmt, expr
Would it be possible to add an getAnEnclosingStmt (or similar) predicate to Expr?
Example implementation:
Stmt getAnEnclosingStmt() {
result = getEnclosingStmt().getEnclosingStmt*()
}
Description of the issue
Now and then I want to find out if a Stmt encloses (directly or transitively) an Expr.
Maybe I am missing something, but it appears doing this is rather verbose because it is not possible to use a transitive closure for
Expr.getEnclosingStmt, so instead ofyou have to write
Would it be possible to add an
getAnEnclosingStmt(or similar) predicate to Expr?Example implementation: