mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: Moves predicates over to suffixed form
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
import python
|
||||
|
||||
from ExceptFlowNode ex, Object t, ClassObject c, ControlFlowNode origin, string what
|
||||
where ex.handledException(t, c, origin) and
|
||||
where ex.handledException_objectapi(t, c, origin) and
|
||||
(
|
||||
exists(ClassObject x | x = t |
|
||||
not x.isLegalExceptionType() and
|
||||
|
||||
@@ -271,7 +271,7 @@ class ExceptFlowNode extends ControlFlowNode {
|
||||
|
||||
/** Gets the inferred type(s) that are handled by this node, splitting tuples if possible. */
|
||||
pragma [noinline]
|
||||
predicate handledException(Object obj, ClassObject cls, ControlFlowNode origin) {
|
||||
predicate handledException_objectapi(Object obj, ClassObject cls, ControlFlowNode origin) {
|
||||
this.handledObject(obj, cls, origin) and not cls = theTupleType()
|
||||
or
|
||||
not exists(this.getNode().(ExceptStmt).getType()) and obj = theBaseExceptionType() and cls = theTypeType() and
|
||||
@@ -281,7 +281,7 @@ class ExceptFlowNode extends ControlFlowNode {
|
||||
/** Whether this `except` handles `cls` */
|
||||
predicate handles(ClassObject cls) {
|
||||
exists(ClassObject handled |
|
||||
this.handledException(handled, _, _) |
|
||||
this.handledException_objectapi(handled, _, _) |
|
||||
cls.getAnImproperSuperType() = handled
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
import python
|
||||
|
||||
from ExceptFlowNode ex, Object obj
|
||||
where ex.handledException(obj, _, _)
|
||||
where ex.handledException_objectapi(obj, _, _)
|
||||
select ex.getLocation().getStartLine(), ex.toString(), obj.toString()
|
||||
@@ -2,5 +2,5 @@
|
||||
import python
|
||||
|
||||
from ExceptFlowNode ex, Object obj
|
||||
where ex.handledException(obj, _, _)
|
||||
where ex.handledException_objectapi(obj, _, _)
|
||||
select ex.getLocation().getStartLine(), ex.toString(), obj.toString()
|
||||
@@ -1,5 +1,5 @@
|
||||
import python
|
||||
|
||||
from ExceptFlowNode ex, Object t
|
||||
where ex.handledException(t, _, _)
|
||||
where ex.handledException_objectapi(t, _, _)
|
||||
select ex.getLocation().getStartLine(), ex.toString(), t.toString()
|
||||
Reference in New Issue
Block a user