mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
13 lines
487 B
Plaintext
13 lines
487 B
Plaintext
import python
|
|
|
|
/** Whether the raise statement 'r' raises 'type' from origin 'orig' */
|
|
predicate type_or_typeof(Raise r, ClassValue type, AstNode orig) {
|
|
exists(Expr exception | exception = r.getRaised() |
|
|
exception.pointsTo(type, orig)
|
|
or
|
|
not exists(ClassValue exc_type | exception.pointsTo(exc_type)) and
|
|
not type = ClassValue::type() and // First value is an unknown exception type
|
|
exists(Value val | exception.pointsTo(val, orig) | val.getClass() = type)
|
|
)
|
|
}
|