-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathI.cs
More file actions
48 lines (40 loc) · 995 Bytes
/
I.cs
File metadata and controls
48 lines (40 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
public class I
{
object Field1;
object Field2;
public I()
{
Field1 = Source<object>(1);
Field2 = Source<object>(2);
}
private void M()
{
var o = Source<object>(3);
var i = new I();
i.Field1 = o;
i.Field2 = o;
i.Field2 = null;
Sink(i.Field1); // $ hasValueFlow=3
Sink(i.Field2); // no flow
i = new I();
i.Field2 = null;
Sink(i.Field1); // $ hasValueFlow=1
Sink(i.Field2); // no flow
i = new I() { Field2 = null };
Sink(i.Field1); // $ hasValueFlow=1
Sink(i.Field2); // no flow
i = new I();
o = Source<object>(4);
i.Field1 = o;
i.Field2 = o;
M2(i);
}
private void M2(I i)
{
i.Field2 = null;
Sink(i.Field1); // $ hasValueFlow=4
Sink(i.Field2); // no flow
}
public static void Sink(object o) { }
static T Source<T>(object source) => throw null;
}