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 1212| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | async |
1313| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | private |
1414| 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 33| 42 | async.cs:42:46:42:70 | await ... | async.cs:42:52:42:70 | call to method OpenAsync |
44| 44 | async.cs:44:38:44:66 | await ... | async.cs:44:44:44:66 | call to method ReadToEndAsync |
55| 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)
5252 await PrintContentLengthAsync ( filename ) ;
5353 return File . OpenText ( filename ) ;
5454 }
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+ }
5576 }
5677}
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