Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7eae5f9

Browse files
committed
C#: Update data-flow test
1 parent 2830739 commit 7eae5f9

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

csharp/ql/test/library-tests/dataflow/fields/FieldFlow.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ edges
203203
| H.cs:130:9:130:9 | [post] access to local variable a [FieldA] : Object | H.cs:131:18:131:18 | access to local variable a [FieldA] : Object |
204204
| H.cs:130:20:130:31 | object creation of type Object : Object | H.cs:130:9:130:9 | [post] access to local variable a [FieldA] : Object |
205205
| H.cs:131:18:131:18 | access to local variable a [FieldA] : Object | H.cs:131:14:131:19 | call to method Get |
206-
| H.cs:147:17:147:37 | call to method Through : Object | H.cs:148:14:148:14 | access to local variable o |
207-
| H.cs:147:25:147:36 | object creation of type Object : Object | H.cs:147:17:147:37 | call to method Through : Object |
206+
| H.cs:147:17:147:32 | call to method Through : A | H.cs:148:14:148:14 | access to local variable a |
207+
| H.cs:147:25:147:31 | object creation of type A : A | H.cs:147:17:147:32 | call to method Through : A |
208208
nodes
209209
| A.cs:5:17:5:23 | object creation of type C : C | semmle.label | object creation of type C : C |
210210
| A.cs:6:17:6:25 | call to method Make [c] : C | semmle.label | call to method Make [c] : C |
@@ -437,9 +437,9 @@ nodes
437437
| H.cs:130:20:130:31 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
438438
| H.cs:131:14:131:19 | call to method Get | semmle.label | call to method Get |
439439
| H.cs:131:18:131:18 | access to local variable a [FieldA] : Object | semmle.label | access to local variable a [FieldA] : Object |
440-
| H.cs:147:17:147:37 | call to method Through : Object | semmle.label | call to method Through : Object |
441-
| H.cs:147:25:147:36 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
442-
| H.cs:148:14:148:14 | access to local variable o | semmle.label | access to local variable o |
440+
| H.cs:147:17:147:32 | call to method Through : A | semmle.label | call to method Through : A |
441+
| H.cs:147:25:147:31 | object creation of type A : A | semmle.label | object creation of type A : A |
442+
| H.cs:148:14:148:14 | access to local variable a | semmle.label | access to local variable a |
443443
#select
444444
| A.cs:7:14:7:16 | access to field c | A.cs:5:17:5:23 | object creation of type C : C | A.cs:7:14:7:16 | access to field c | $@ | A.cs:5:17:5:23 | object creation of type C : C | object creation of type C : C |
445445
| A.cs:14:14:14:20 | call to method Get | A.cs:13:15:13:22 | object creation of type C1 : C1 | A.cs:14:14:14:20 | call to method Get | $@ | A.cs:13:15:13:22 | object creation of type C1 : C1 | object creation of type C1 : C1 |
@@ -486,4 +486,4 @@ nodes
486486
| H.cs:90:14:90:22 | access to field FieldB | H.cs:88:20:88:31 | object creation of type Object : Object | H.cs:90:14:90:22 | access to field FieldB | $@ | H.cs:88:20:88:31 | object creation of type Object : Object | object creation of type Object : Object |
487487
| H.cs:114:14:114:21 | access to field FieldB | H.cs:112:20:112:31 | object creation of type Object : Object | H.cs:114:14:114:21 | access to field FieldB | $@ | H.cs:112:20:112:31 | object creation of type Object : Object | object creation of type Object : Object |
488488
| H.cs:131:14:131:19 | call to method Get | H.cs:130:20:130:31 | object creation of type Object : Object | H.cs:131:14:131:19 | call to method Get | $@ | H.cs:130:20:130:31 | object creation of type Object : Object | object creation of type Object : Object |
489-
| H.cs:148:14:148:14 | access to local variable o | H.cs:147:25:147:36 | object creation of type Object : Object | H.cs:148:14:148:14 | access to local variable o | $@ | H.cs:147:25:147:36 | object creation of type Object : Object | object creation of type Object : Object |
489+
| H.cs:148:14:148:14 | access to local variable a | H.cs:147:25:147:31 | object creation of type A : A | H.cs:148:14:148:14 | access to local variable a | $@ | H.cs:147:25:147:31 | object creation of type A : A | object creation of type A : A |

csharp/ql/test/library-tests/dataflow/fields/H.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,16 @@ void M6(object o)
138138
object Through(object o)
139139
{
140140
var a = new A();
141-
a.FieldA = o;
141+
a.FieldA = o as A;
142142
return Transform(a).FieldB;
143143
}
144144

145145
void M7()
146146
{
147-
var o = Through(new object());
148-
Sink(o); // flow
147+
var a = Through(new A());
148+
Sink(a); // flow
149+
var b = Through(new B());
150+
Sink(b); // no flow
149151
}
150152

151153
public static void Sink(object o) { }

0 commit comments

Comments
 (0)