File tree Expand file tree Collapse file tree 4 files changed +17
-12
lines changed
ql/test/library-tests/arguments Expand file tree Collapse file tree 4 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 4
4
using Semmle . Extraction . CSharp . Entities . Expressions ;
5
5
using Semmle . Extraction . Kinds ;
6
6
using System ;
7
+ using System . Collections . Generic ;
7
8
using System . IO ;
8
9
using System . Linq ;
9
10
@@ -324,7 +325,12 @@ public void MakeConditional(TextWriter trapFile)
324
325
325
326
public void PopulateArguments ( TextWriter trapFile , BaseArgumentListSyntax args , int child )
326
327
{
327
- foreach ( var arg in args . Arguments )
328
+ PopulateArguments ( trapFile , args . Arguments , child ) ;
329
+ }
330
+
331
+ public void PopulateArguments ( TextWriter trapFile , IEnumerable < ArgumentSyntax > args , int child )
332
+ {
333
+ foreach ( var arg in args )
328
334
PopulateArgument ( trapFile , arg , child ++ ) ;
329
335
}
330
336
Original file line number Diff line number Diff line change @@ -105,12 +105,7 @@ protected override void PopulateExpression(TextWriter trapFile)
105
105
if ( assignment . Left is ImplicitElementAccessSyntax iea )
106
106
{
107
107
// An array/indexer initializer of the form `[...] = ...`
108
-
109
- var indexChild = 0 ;
110
- foreach ( var arg in iea . ArgumentList . Arguments )
111
- {
112
- Expression . Create ( Context , arg . Expression , access , indexChild ++ ) ;
113
- }
108
+ access . PopulateArguments ( trapFile , iea . ArgumentList . Arguments , 0 ) ;
114
109
}
115
110
}
116
111
else
Original file line number Diff line number Diff line change @@ -15,11 +15,7 @@ private Tuple(ExpressionNodeInfo info) : base(info.SetKind(ExprKind.TUPLE))
15
15
16
16
protected override void PopulateExpression ( TextWriter trapFile )
17
17
{
18
- var child = 0 ;
19
- foreach ( var argument in Syntax . Arguments . Select ( a => a . Expression ) )
20
- {
21
- Expression . Create ( Context , argument , this , child ++ ) ;
22
- }
18
+ PopulateArguments ( trapFile , Syntax . Arguments , 0 ) ;
23
19
}
24
20
}
25
21
}
Original file line number Diff line number Diff line change 24
24
| arguments.cs:45:35:45:38 | null | 0 |
25
25
| arguments.cs:55:21:55:21 | 1 | 0 |
26
26
| arguments.cs:55:24:55:24 | 2 | 0 |
27
+ | arguments.cs:56:10:56:13 | access to property Prop | 0 |
28
+ | arguments.cs:56:16:56:25 | access to indexer | 0 |
27
29
| arguments.cs:56:21:56:21 | 3 | 0 |
28
30
| arguments.cs:56:24:56:24 | 4 | 0 |
31
+ | arguments.cs:56:31:56:31 | 5 | 0 |
32
+ | arguments.cs:56:34:56:34 | 6 | 0 |
29
33
| arguments.cs:59:14:59:14 | 8 | 0 |
30
34
| arguments.cs:59:17:59:17 | 9 | 0 |
31
35
| arguments.cs:60:14:60:15 | 10 | 0 |
32
36
| arguments.cs:60:14:60:15 | 10 | 0 |
33
37
| arguments.cs:60:18:60:19 | 11 | 0 |
34
38
| arguments.cs:60:18:60:19 | 11 | 0 |
39
+ | arguments.cs:61:22:61:23 | 13 | 0 |
40
+ | arguments.cs:61:26:61:27 | 14 | 0 |
41
+ | arguments.cs:62:10:62:13 | access to property Prop | 0 |
42
+ | arguments.cs:62:16:62:27 | access to indexer | 0 |
35
43
| arguments.cs:62:21:62:22 | 15 | 0 |
36
44
| arguments.cs:62:25:62:26 | 16 | 0 |
You can’t perform that action at this time.
0 commit comments