File tree Expand file tree Collapse file tree 6 files changed +56
-0
lines changed
csharp/ql/test/library-tests Expand file tree Collapse file tree 6 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 12
12
| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | async |
13
13
| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | private |
14
14
| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | static |
15
+ | async.cs:64:40:64:53 | GetObjectAsync | file://:0:0:0:0 | async |
16
+ | async.cs:64:40:64:53 | GetObjectAsync | file://:0:0:0:0 | private |
17
+ | async.cs:64:40:64:53 | GetObjectAsync | file://:0:0:0:0 | static |
Original file line number Diff line number Diff line change 3
3
| 42 | async.cs:42:46:42:70 | await ... | async.cs:42:52:42:70 | call to method OpenAsync |
4
4
| 44 | async.cs:44:38:44:66 | await ... | async.cs:44:44:44:66 | call to method ReadToEndAsync |
5
5
| 52 | async.cs:52:13:52:51 | await ... | async.cs:52:19:52:51 | call to method PrintContentLengthAsync |
6
+ | 73 | async.cs:73:13:73:31 | await ... | async.cs:73:19:73:31 | call to method Delay |
Original file line number Diff line number Diff line change @@ -52,5 +52,26 @@ private static async Task<StreamReader> OpenAsync(string filename)
52
52
await PrintContentLengthAsync ( filename ) ;
53
53
return File . OpenText ( filename ) ;
54
54
}
55
+
56
+ private ref struct RS
57
+ {
58
+ public int GetZero ( ) { return 0 ; }
59
+ }
60
+
61
+ private static int one = 1 ;
62
+
63
+ // Test that we can use ref locals, ref structs and unsafe blocks in async methods.
64
+ private static async Task < int > GetObjectAsync ( )
65
+ {
66
+ unsafe
67
+ {
68
+ // Do pointer stuff
69
+ }
70
+ RS rs ;
71
+ ref int i = ref one ;
72
+ var zero = rs . GetZero ( ) ;
73
+ await Task . Delay ( i ) ;
74
+ return zero ;
75
+ }
55
76
}
56
77
}
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+
4
+ public ref struct RS
5
+ {
6
+ public int GetZero ( ) { return 0 ; }
7
+ }
8
+
9
+ public class C
10
+ {
11
+ private int one = 1 ;
12
+
13
+ // Test that we can use unsafe context, ref locals and ref structs in iterators.
14
+ public IEnumerable < int > GetObjects ( )
15
+ {
16
+ unsafe
17
+ {
18
+ // Do pointer stuff
19
+ }
20
+ ref int i = ref one ;
21
+ RS rs ;
22
+ var zero = rs . GetZero ( ) ;
23
+ yield return zero ;
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ | iterators.cs:14:29:14:38 | GetObjects | iterators.cs:23:22:23:25 | access to local variable zero |
Original file line number Diff line number Diff line change
1
+ import csharp
2
+
3
+ from Callable c , Expr return
4
+ where c .canYieldReturn ( return )
5
+ select c , return
You can’t perform that action at this time.
0 commit comments