File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
python/ql/test/experimental/dataflow/consistency Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ # Originally we had module and functions as `DataFlowCallable``, and any call inside a
2+ # class scope would not have a result for getEnclosingCallable. Since this was only a
3+ # consistency error for calls, originally we added a new `DataFlowClassScope` only for
4+ # those classes that had a call in their scope. That's why all the class definitions in
5+ # this test do a call to the dummy function `func`.
6+ #
7+ # Note: this was shortsighted, since most DataFlow::Node use `getCallableScope` helper
8+ # to define their .getEnclosingCallable(), which picks the first DataFlowCallable to
9+ # contain the node. (so for some classes that would be DataFlowClassScope, and for some
10+ # it would be the module/function containing the class definition)
11+
12+ def func (* args , ** kwargs ):
13+ print ("func()" )
14+
15+ class Cls :
16+ func ()
17+ class Inner :
18+ func ()
19+
20+ def other_func ():
21+ class Cls2 :
22+ func ()
23+ return Cls2
24+
25+ x = other_func ()
Original file line number Diff line number Diff line change 11uniqueEnclosingCallable
22uniqueCallEnclosingCallable
3+ | class_scope.py:16:5:16:10 | func() | Call should have one enclosing callable but has 0. |
4+ | class_scope.py:16:5:16:10 | func() | Call should have one enclosing callable but has 0. |
5+ | class_scope.py:18:9:18:14 | func() | Call should have one enclosing callable but has 0. |
6+ | class_scope.py:18:9:18:14 | func() | Call should have one enclosing callable but has 0. |
7+ | class_scope.py:22:9:22:14 | func() | Call should have one enclosing callable but has 0. |
8+ | class_scope.py:22:9:22:14 | func() | Call should have one enclosing callable but has 0. |
39uniqueType
410uniqueNodeLocation
511missingLocation
You can’t perform that action at this time.
0 commit comments