mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Improve check for containment in with statement
This commit is contained in:
@@ -88,6 +88,12 @@ class WithStatement extends FileClose {
|
||||
With w;
|
||||
|
||||
WithStatement() { this.asExpr() = w.getContextExpr() }
|
||||
|
||||
override predicate guardsExceptions(DataFlow::CfgNode fileRaises) {
|
||||
super.guardsExceptions(fileRaises)
|
||||
or
|
||||
w.getBody().contains(fileRaises.asExpr())
|
||||
}
|
||||
}
|
||||
|
||||
/** Holds if an exception may be raised at `raises` if `file` is a file object. */
|
||||
|
||||
Reference in New Issue
Block a user