@@ -6,7 +6,7 @@ import TestUtilities.InlineExpectationsTest
6
6
// -----------------------------------------------------------------------------
7
7
// tracked
8
8
// -----------------------------------------------------------------------------
9
- DataFlow:: Node tracked ( TypeTracker t ) {
9
+ DataFlow:: LocalSourceNode tracked ( TypeTracker t ) {
10
10
t .start ( ) and
11
11
result .asCfgNode ( ) = any ( NameNode n | n .getId ( ) = "tracked" )
12
12
or
@@ -20,7 +20,7 @@ class TrackedTest extends InlineExpectationsTest {
20
20
21
21
override predicate hasActualResult ( Location location , string element , string tag , string value ) {
22
22
exists ( DataFlow:: Node e , TypeTracker t |
23
- e = tracked ( t ) and
23
+ tracked ( t ) . flowsTo ( e ) and
24
24
// Module variables have no sensible location, and hence can't be annotated.
25
25
not e instanceof DataFlow:: ModuleVariableNode and
26
26
tag = "tracked" and
@@ -34,14 +34,14 @@ class TrackedTest extends InlineExpectationsTest {
34
34
// -----------------------------------------------------------------------------
35
35
// int + str
36
36
// -----------------------------------------------------------------------------
37
- DataFlow:: Node int_type ( TypeTracker t ) {
37
+ DataFlow:: LocalSourceNode int_type ( TypeTracker t ) {
38
38
t .start ( ) and
39
39
result .asCfgNode ( ) = any ( CallNode c | c .getFunction ( ) .( NameNode ) .getId ( ) = "int" )
40
40
or
41
41
exists ( TypeTracker t2 | result = int_type ( t2 ) .track ( t2 , t ) )
42
42
}
43
43
44
- DataFlow:: Node string_type ( TypeTracker t ) {
44
+ DataFlow:: LocalSourceNode string_type ( TypeTracker t ) {
45
45
t .start ( ) and
46
46
result .asCfgNode ( ) = any ( CallNode c | c .getFunction ( ) .( NameNode ) .getId ( ) = "str" )
47
47
or
@@ -55,7 +55,7 @@ class TrackedIntTest extends InlineExpectationsTest {
55
55
56
56
override predicate hasActualResult ( Location location , string element , string tag , string value ) {
57
57
exists ( DataFlow:: Node e , TypeTracker t |
58
- e = int_type ( t ) and
58
+ int_type ( t ) . flowsTo ( e ) and
59
59
tag = "int" and
60
60
location = e .getLocation ( ) and
61
61
value = t .getAttr ( ) and
@@ -71,7 +71,7 @@ class TrackedStringTest extends InlineExpectationsTest {
71
71
72
72
override predicate hasActualResult ( Location location , string element , string tag , string value ) {
73
73
exists ( DataFlow:: Node e , TypeTracker t |
74
- e = string_type ( t ) and
74
+ string_type ( t ) . flowsTo ( e ) and
75
75
tag = "str" and
76
76
location = e .getLocation ( ) and
77
77
value = t .getAttr ( ) and
@@ -83,7 +83,7 @@ class TrackedStringTest extends InlineExpectationsTest {
83
83
// -----------------------------------------------------------------------------
84
84
// tracked_self
85
85
// -----------------------------------------------------------------------------
86
- DataFlow:: Node tracked_self ( TypeTracker t ) {
86
+ DataFlow:: LocalSourceNode tracked_self ( TypeTracker t ) {
87
87
t .start ( ) and
88
88
exists ( Function f |
89
89
f .isMethod ( ) and
@@ -101,7 +101,7 @@ class TrackedSelfTest extends InlineExpectationsTest {
101
101
102
102
override predicate hasActualResult ( Location location , string element , string tag , string value ) {
103
103
exists ( DataFlow:: Node e , TypeTracker t |
104
- e = tracked_self ( t ) and
104
+ tracked_self ( t ) . flowsTo ( e ) and
105
105
// Module variables have no sensible location, and hence can't be annotated.
106
106
not e instanceof DataFlow:: ModuleVariableNode and
107
107
tag = "tracked_self" and
@@ -117,18 +117,18 @@ class TrackedSelfTest extends InlineExpectationsTest {
117
117
// -----------------------------------------------------------------------------
118
118
// This modeling follows the same pattern that we currently use in our real library modeling.
119
119
/** Gets a reference to `foo` (fictive module). */
120
- private DataFlow:: Node foo ( DataFlow:: TypeTracker t ) {
120
+ private DataFlow:: LocalSourceNode foo ( DataFlow:: TypeTracker t ) {
121
121
t .start ( ) and
122
122
result = DataFlow:: importNode ( "foo" )
123
123
or
124
124
exists ( DataFlow:: TypeTracker t2 | result = foo ( t2 ) .track ( t2 , t ) )
125
125
}
126
126
127
127
/** Gets a reference to `foo` (fictive module). */
128
- DataFlow:: Node foo ( ) { result = foo ( DataFlow:: TypeTracker:: end ( ) ) }
128
+ DataFlow:: Node foo ( ) { foo ( DataFlow:: TypeTracker:: end ( ) ) . flowsTo ( result ) }
129
129
130
130
/** Gets a reference to `foo.bar` (fictive module). */
131
- private DataFlow:: Node foo_bar ( DataFlow:: TypeTracker t ) {
131
+ private DataFlow:: LocalSourceNode foo_bar ( DataFlow:: TypeTracker t ) {
132
132
t .start ( ) and
133
133
result = DataFlow:: importNode ( "foo.bar" )
134
134
or
@@ -139,10 +139,10 @@ private DataFlow::Node foo_bar(DataFlow::TypeTracker t) {
139
139
}
140
140
141
141
/** Gets a reference to `foo.bar` (fictive module). */
142
- DataFlow:: Node foo_bar ( ) { result = foo_bar ( DataFlow:: TypeTracker:: end ( ) ) }
142
+ DataFlow:: Node foo_bar ( ) { foo_bar ( DataFlow:: TypeTracker:: end ( ) ) . flowsTo ( result ) }
143
143
144
144
/** Gets a reference to `foo.bar.baz` (fictive attribute on `foo.bar` module). */
145
- private DataFlow:: Node foo_bar_baz ( DataFlow:: TypeTracker t ) {
145
+ private DataFlow:: LocalSourceNode foo_bar_baz ( DataFlow:: TypeTracker t ) {
146
146
t .start ( ) and
147
147
result = DataFlow:: importNode ( "foo.bar.baz" )
148
148
or
@@ -153,7 +153,7 @@ private DataFlow::Node foo_bar_baz(DataFlow::TypeTracker t) {
153
153
}
154
154
155
155
/** Gets a reference to `foo.bar.baz` (fictive attribute on `foo.bar` module). */
156
- DataFlow:: Node foo_bar_baz ( ) { result = foo_bar_baz ( DataFlow:: TypeTracker:: end ( ) ) }
156
+ DataFlow:: Node foo_bar_baz ( ) { foo_bar_baz ( DataFlow:: TypeTracker:: end ( ) ) . flowsTo ( result ) }
157
157
158
158
class TrackedFooBarBaz extends InlineExpectationsTest {
159
159
TrackedFooBarBaz ( ) { this = "TrackedFooBarBaz" }
0 commit comments