Skip to content

Commit ea4ea6b

Browse files
authored
Merge pull request #4529 from tausbn/python-remove-cartesian-product-in-tkwoverflownode
Python: Remove bad join in `getCallableScope`
2 parents 2479402 + 31c169d commit ea4ea6b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

python/ql/src/experimental/dataflow/internal/DataFlowPublic.qll

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ newtype TNode =
6262
call_unpacks(call, _, callable, name, _)
6363
}
6464

65+
/** Helper for `Node::getEnclosingCallable`. */
66+
private DataFlowCallable getCallableScope(Scope s) {
67+
result.getScope() = s
68+
or
69+
not exists(DataFlowCallable c | c.getScope() = s) and
70+
result = getCallableScope(s.getEnclosingScope())
71+
}
72+
6573
/**
6674
* An element, viewed as a node in a data flow graph. Either an SSA variable
6775
* (`EssaNode`) or a control flow node (`CfgNode`).
@@ -73,13 +81,6 @@ class Node extends TNode {
7381
/** Gets the scope of this node. */
7482
Scope getScope() { none() }
7583

76-
private DataFlowCallable getCallableScope(Scope s) {
77-
result.getScope() = s
78-
or
79-
not exists(DataFlowCallable c | c.getScope() = s) and
80-
result = getCallableScope(s.getEnclosingScope())
81-
}
82-
8384
/** Gets the enclosing callable of this node. */
8485
DataFlowCallable getEnclosingCallable() { result = getCallableScope(this.getScope()) }
8586

0 commit comments

Comments
 (0)