@@ -6,7 +6,7 @@ import TestUtilities.InlineExpectationsTest
66// -----------------------------------------------------------------------------
77// tracked
88// -----------------------------------------------------------------------------
9- DataFlow:: Node tracked ( TypeTracker t ) {
9+ DataFlow:: LocalSourceNode tracked ( TypeTracker t ) {
1010 t .start ( ) and
1111 result .asCfgNode ( ) = any ( NameNode n | n .getId ( ) = "tracked" )
1212 or
@@ -20,7 +20,7 @@ class TrackedTest extends InlineExpectationsTest {
2020
2121 override predicate hasActualResult ( Location location , string element , string tag , string value ) {
2222 exists ( DataFlow:: Node e , TypeTracker t |
23- e = tracked ( t ) and
23+ tracked ( t ) . flowsTo ( e ) and
2424 // Module variables have no sensible location, and hence can't be annotated.
2525 not e instanceof DataFlow:: ModuleVariableNode and
2626 tag = "tracked" and
@@ -34,14 +34,14 @@ class TrackedTest extends InlineExpectationsTest {
3434// -----------------------------------------------------------------------------
3535// int + str
3636// -----------------------------------------------------------------------------
37- DataFlow:: Node int_type ( TypeTracker t ) {
37+ DataFlow:: LocalSourceNode int_type ( TypeTracker t ) {
3838 t .start ( ) and
3939 result .asCfgNode ( ) = any ( CallNode c | c .getFunction ( ) .( NameNode ) .getId ( ) = "int" )
4040 or
4141 exists ( TypeTracker t2 | result = int_type ( t2 ) .track ( t2 , t ) )
4242}
4343
44- DataFlow:: Node string_type ( TypeTracker t ) {
44+ DataFlow:: LocalSourceNode string_type ( TypeTracker t ) {
4545 t .start ( ) and
4646 result .asCfgNode ( ) = any ( CallNode c | c .getFunction ( ) .( NameNode ) .getId ( ) = "str" )
4747 or
@@ -55,7 +55,7 @@ class TrackedIntTest extends InlineExpectationsTest {
5555
5656 override predicate hasActualResult ( Location location , string element , string tag , string value ) {
5757 exists ( DataFlow:: Node e , TypeTracker t |
58- e = int_type ( t ) and
58+ int_type ( t ) . flowsTo ( e ) and
5959 tag = "int" and
6060 location = e .getLocation ( ) and
6161 value = t .getAttr ( ) and
@@ -71,7 +71,7 @@ class TrackedStringTest extends InlineExpectationsTest {
7171
7272 override predicate hasActualResult ( Location location , string element , string tag , string value ) {
7373 exists ( DataFlow:: Node e , TypeTracker t |
74- e = string_type ( t ) and
74+ string_type ( t ) . flowsTo ( e ) and
7575 tag = "str" and
7676 location = e .getLocation ( ) and
7777 value = t .getAttr ( ) and
@@ -83,7 +83,7 @@ class TrackedStringTest extends InlineExpectationsTest {
8383// -----------------------------------------------------------------------------
8484// tracked_self
8585// -----------------------------------------------------------------------------
86- DataFlow:: Node tracked_self ( TypeTracker t ) {
86+ DataFlow:: LocalSourceNode tracked_self ( TypeTracker t ) {
8787 t .start ( ) and
8888 exists ( Function f |
8989 f .isMethod ( ) and
@@ -101,7 +101,7 @@ class TrackedSelfTest extends InlineExpectationsTest {
101101
102102 override predicate hasActualResult ( Location location , string element , string tag , string value ) {
103103 exists ( DataFlow:: Node e , TypeTracker t |
104- e = tracked_self ( t ) and
104+ tracked_self ( t ) . flowsTo ( e ) and
105105 // Module variables have no sensible location, and hence can't be annotated.
106106 not e instanceof DataFlow:: ModuleVariableNode and
107107 tag = "tracked_self" and
@@ -117,18 +117,18 @@ class TrackedSelfTest extends InlineExpectationsTest {
117117// -----------------------------------------------------------------------------
118118// This modeling follows the same pattern that we currently use in our real library modeling.
119119/** Gets a reference to `foo` (fictive module). */
120- private DataFlow:: Node foo ( DataFlow:: TypeTracker t ) {
120+ private DataFlow:: LocalSourceNode foo ( DataFlow:: TypeTracker t ) {
121121 t .start ( ) and
122122 result = DataFlow:: importNode ( "foo" )
123123 or
124124 exists ( DataFlow:: TypeTracker t2 | result = foo ( t2 ) .track ( t2 , t ) )
125125}
126126
127127/** 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 ) }
129129
130130/** 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 ) {
132132 t .start ( ) and
133133 result = DataFlow:: importNode ( "foo.bar" )
134134 or
@@ -139,10 +139,10 @@ private DataFlow::Node foo_bar(DataFlow::TypeTracker t) {
139139}
140140
141141/** 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 ) }
143143
144144/** 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 ) {
146146 t .start ( ) and
147147 result = DataFlow:: importNode ( "foo.bar.baz" )
148148 or
@@ -153,7 +153,7 @@ private DataFlow::Node foo_bar_baz(DataFlow::TypeTracker t) {
153153}
154154
155155/** 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 ) }
157157
158158class TrackedFooBarBaz extends InlineExpectationsTest {
159159 TrackedFooBarBaz ( ) { this = "TrackedFooBarBaz" }
0 commit comments