File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
python/ql/test/experimental/dataflow/typetracking Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,41 @@ def test_import():
56
56
y # $tracked
57
57
mymodule .z # $tracked
58
58
59
+
60
+ def to_inner_scope ():
61
+ x = tracked # $tracked
62
+ def foo ():
63
+ y = x # $ MISSING: tracked
64
+ return y # $ MISSING: tracked
65
+ also_x = foo () # $ MISSING: tracked
66
+ print (also_x ) # $ MISSING: tracked
67
+
68
+
69
+ def my_decorator (func ):
70
+ # This part doesn't make any sense in a normal decorator, but just shows how we
71
+ # handle type-tracking
72
+
73
+ func () # $tracked
74
+
75
+ def wrapper ():
76
+ print ("before function call" )
77
+ val = func () # $ MISSING: tracked
78
+ print ("after function call" )
79
+ return val # $ MISSING: tracked
80
+ return wrapper
81
+
82
+ @my_decorator
83
+ def get_tracked2 ():
84
+ return tracked # $tracked
85
+
86
+ @my_decorator
87
+ def unrelated_func ():
88
+ return "foo"
89
+
90
+ def use_funcs_with_decorators ():
91
+ x = get_tracked2 () # $ MISSING: tracked
92
+ y = unrelated_func ()
93
+
59
94
# ------------------------------------------------------------------------------
60
95
61
96
def expects_int (x ): # $int
You can’t perform that action at this time.
0 commit comments