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 44using Semmle . Extraction . CSharp . Entities . Expressions ;
55using Semmle . Extraction . Kinds ;
66using System ;
7+ using System . Collections . Generic ;
78using System . IO ;
89using System . Linq ;
910
@@ -324,7 +325,12 @@ public void MakeConditional(TextWriter trapFile)
324325
325326 public void PopulateArguments ( TextWriter trapFile , BaseArgumentListSyntax args , int child )
326327 {
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 )
328334 PopulateArgument ( trapFile , arg , child ++ ) ;
329335 }
330336
Original file line number Diff line number Diff line change @@ -105,12 +105,7 @@ protected override void PopulateExpression(TextWriter trapFile)
105105 if ( assignment . Left is ImplicitElementAccessSyntax iea )
106106 {
107107 // 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 ) ;
114109 }
115110 }
116111 else
Original file line number Diff line number Diff line change @@ -15,11 +15,7 @@ private Tuple(ExpressionNodeInfo info) : base(info.SetKind(ExprKind.TUPLE))
1515
1616 protected override void PopulateExpression ( TextWriter trapFile )
1717 {
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 ) ;
2319 }
2420 }
2521}
Original file line number Diff line number Diff line change 2424| arguments.cs:45:35:45:38 | null | 0 |
2525| arguments.cs:55:21:55:21 | 1 | 0 |
2626| 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 |
2729| arguments.cs:56:21:56:21 | 3 | 0 |
2830| 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 |
2933| arguments.cs:59:14:59:14 | 8 | 0 |
3034| arguments.cs:59:17:59:17 | 9 | 0 |
3135| arguments.cs:60:14:60:15 | 10 | 0 |
3236| arguments.cs:60:14:60:15 | 10 | 0 |
3337| arguments.cs:60:18:60:19 | 11 | 0 |
3438| 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 |
3543| arguments.cs:62:21:62:22 | 15 | 0 |
3644| arguments.cs:62:25:62:26 | 16 | 0 |
You can’t perform that action at this time.
0 commit comments