8000 C#: Add more test cases to argument-parameter mapping test · github/codeql@93b0eb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93b0eb9

Browse files
committed
C#: Add more test cases to argument-parameter mapping test
1 parent 93d9332 commit 93b0eb9

File tree

7 files changed

+399
-202
lines changed

7 files changed

+399
-202
lines changed

csharp/ql/test/library-tests/arguments/PrintAst.expected

Lines changed: 222 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -117,137 +117,239 @@ arguments.cs:
117117
# 40| 0: [IntLiteral] 1
118118
# 40| 1: [IntLiteral] 2
119119
# 40| 1: [IntLiteral] 0
120-
# 43| 10: [Method] f4
121-
# 43| -1: [TypeMention] Void
120+
# 41| 6: [LocalVariableDeclStmt] ... ...;
121+
# 41| 0: [LocalVariableDeclAndInitExpr] Int16 s1 = ...
122+
# 41| -1: [TypeMention] short
123+
# 41| 0: [LocalVariableAccess] access to local variable s1
124+
# 41| 1: [CastExpr] (...) ...
125+
# 41| 1: [IntLiteral] 1
126+
# 41| 1: [LocalVariableDeclAndInitExpr] Int16 s2 = ...
127+
# 41| -1: [TypeMention] short
128+
# 41| 0: [LocalVariableAccess] access to local variable s2
129+
# 41| 1: [CastExpr] (...) ...
130+
# 41| 1: [IntLiteral] 2
131+
# 42| 7: [ExprStmt] ...;
132+
# 42| 0: [MethodCall] call to method f3
133+
# 42| 0: [IntLiteral] 0
134+
# 42| 1: [CastExpr] (...) ...
135+
# 42| 1: [LocalVariableAccess] access to local variable s1
136+
# 42| 2: [CastExpr] (...) ...
137+
# 42| 1: [LocalVariableAccess] access to local variable s2
138+
# 45| 10: [Method] f4
139+
# 45| -1: [TypeMention] Void
122140
#-----| 2: (Parameters)
123-
# 43| 0: [Parameter] args
124-
# 43| -1: [TypeMention] Object[]
125-
# 43| 1: [TypeMention] object
126-
# 44| 4: [BlockStmt] {...}
127-
# 45| 0: [ExprStmt] ...;
128-
# 45| 0: [MethodCall] call to method f4
129-
# 45| 0: [ArrayCreation] array creation of type Object[]
130-
# 45| -2: [TypeMention] Object[]
131-
# 45| 1: [TypeMention] object
132-
# 45| -1: [ArrayInitializer] { ..., ... }
133-
# 45| 0: [NullLiteral] null
134-
# 45| 1: [NullLiteral] null
135-
# 48| 11: [Property] Prop
136-
# 48| -1: [TypeMention] int
137-
# 48| 3: [Getter] get_Prop
138-
# 48| 4: [Setter] set_Prop
139-
#-----| 2: (Parameters)
140-
# 48| 0: [Parameter] value
141-
# 50| 12: [Indexer] Item
141+
# 45| 0: [Parameter] args
142+
# 45| -1: [TypeMention] Object[]
143+
# 45| 1: [TypeMention] object
144+
# 46| 4: [BlockStmt] {...}
145+
# 47| 0: [ExprStmt] ...;
146+
# 47| 0: [MethodCall] call to method f4
147+
# 47| 0: [ArrayCreation] array creation of type Object[]
148+
# 47| -2: [TypeMention] Object[]
149+
# 47| 1: [TypeMention] object
150+
# 47| -1: [ArrayInitializer] { ..., ... }
151+
# 47| 0: [NullLiteral] null
152+
# 47| 1: [NullLiteral] null
153+
# 50| 11: [Property] Prop
142154
# 50| -1: [TypeMention] int
155+
# 50| 3: [Getter] get_Prop
156+
# 50| 4: [Setter] set_Prop
157+
#-----| 2: (Parameters)
158+
# 50| 0: [Parameter] value
159+
# 52| 12: [Indexer] Item
160+
# 52| -1: [TypeMention] int
143161
#-----| 1: (Parameters)
144-
# 50| 0: [Parameter] a
145-
# 50| -1: [TypeMention] int
146-
# 50| 1: [Parameter] b
147-
# 50| -1: [TypeMention] int
148-
# 50| 3: [Getter] get_Item
162+
6D40 # 52| 0: [Parameter] a
163+
# 52| -1: [TypeMention] int
164+
# 52| 1: [Parameter] b
165+
# 52| -1: [TypeMention] int
166+
# 52| 3: [Getter] get_Item
149167
#-----| 2: (Parameters)
150-
# 50| 0: [Parameter] a
151-
# 50| 1: [Parameter] b
152-
# 50| 4: [AddExpr] ... + ...
153-
# 50| 0: [ParameterAccess] access to parameter a
154-
# 50| 1: [ParameterAccess] access to parameter b
155-
# 50| 4: [Setter] set_Item
168+
# 52| 0: [Parameter] a
169+
# 52| 1: [Parameter] b
170+
# 52| 4: [AddExpr] ... + ...
171+
# 52| 0: [ParameterAccess] access to parameter a
172+
# 52| 1: [ParameterAccess] access to parameter b
173+
# 52| 4: [Setter] set_Item
156174
#-----| 2: (Parameters)
157-
# 50| 0: [Parameter] a
9E88 158-
# 50| 1: [Parameter] b
159-
# 50| 2: [Parameter] value
160-
# 50| 4: [BlockStmt] {...}
161-
# 52| 13: [Method] f5
162-
# 52| -1: [TypeMention] Void
163-
# 53| 4: [BlockStmt] {...}
164-
# 54| 0: [ExprStmt] ...;
165-
# 54| 0: [AssignExpr] ... = ...
166-
# 54| 0: [PropertyCall] access to property Prop
167-
# 54| 1: [IntLiteral] 0
168-
# 55| 1: [ExprStmt] ...;
169-
# 55| 0: [AssignExpr] ... = ...
170-
# 55| 0: [PropertyCall] access to property Prop
171-
# 55| 1: [IndexerCall] access to indexer
172-
# 55| -1: [ThisAccess] this access
173-
# 55| 0: [IntLiteral] 1
174-
# 55| 1: [IntLiteral] 2
175-
# 56| 2: [ExprStmt] ...;
175+
# 52| 0: [Parameter] a
176+
# 52| 1: [Parameter] b
177+
# 52| 2: [Parameter] value
178+
# 52| 4: [BlockStmt] {...}
179+
# 54| 13: [Method] f5
180+
# 54| -1: [TypeMention] Void
181+
# 55| 4: [BlockStmt] {...}
182+
# 56| 0: [ExprStmt] ...;
176183
# 56| 0: [AssignExpr] ... = ...
177-
# 56| 0: [TupleExpr] (..., ...)
178-
# 56| 0: [PropertyCall] access to property Prop
179-
# 56| 1: [IndexerCall] access to indexer
180-
# 56| -1: [ThisAccess] this access
181-
# 56| 0: [IntLiteral] 3
182-
# 56| 1: [IntLiteral] 4
183-
# 56| 1: [TupleExpr] (..., ...)
184-
# 56| 0: [IntLiteral] 5
185-
# 56| 1: [IntLiteral] 6
186-
# 57| 3: [ExprStmt] ...;
187-
# 57| 0: [PostIncrExpr] ...++
184+
# 56| 0: [PropertyCall] access to property Prop
185+
# 56| 1: [IntLiteral] 0
186+
# 57| 1: [ExprStmt] ...;
187+
# 57| 0: [AssignExpr] ... = ...
188188
# 57| 0: [PropertyCall] access to property Prop
189-
# 58| 4: [ExprStmt] ...;
190-
# 58| 0: [AssignAddExpr] ... += ...
191-
# 58| 0: [PropertyCall] access to property Prop
192-
# 58| 1: [IntLiteral] 7
193-
# 59| 5: [ExprStmt] ...;
189+
# 57| 1: [IndexerCall] access to indexer
190+
# 57| -1: [ThisAccess] this access
191+
# 57| 0: [IntLiteral] 1
192+
# 57| 1: [IntLiteral] 2
193+
# 58| 2: [ExprStmt] ...;
194+
# 58| 0: [AssignExpr] ... = ...
195+
# 58| 0: [TupleExpr] (..., ...)
196+
# 58| 0: [PropertyCall] access to property Prop
197+
# 58| 1: [IndexerCall] access to indexer
198+
# 58| -1: [ThisAccess] this access
199+
# 58| 0: [IntLiteral] 3
200+
# 58| 1: [IntLiteral] 4
201+
# 58| 1: [TupleExpr] (..., ...)
202+
# 58| 0: [IntLiteral] 5
203+
# 58| 1: [IntLiteral] 6
204+
# 59| 3: [ExprStmt] ...;
194205
# 59| 0: [PostIncrExpr] ...++
195-
# 59| 0: [IndexerCall] access to indexer
196-
# 59| -1: [ThisAccess] this access
197-
# 59| 0: [IntLiteral] 8
198-
# 59| 1: [IntLiteral] 9
199-
# 60| 6: [ExprStmt] ...;
206+
# 59| 0: [PropertyCall] access to property Prop
207+
# 60| 4: [ExprStmt] ...;
200208
# 60| 0: [AssignAddExpr] ... += ...
201-
# 60| 0: [IndexerCall] access to indexer
202-
# 60| -1: [ThisAccess] this access
203-
# 60| 0: [IntLiteral] 10
204-
# 60| 1: [IntLiteral] 11
205-
# 60| 1: [IntLiteral] 12
206-
# 61| 7: [LocalVariableDeclStmt] ... ...;
207-
# 61| 0: [LocalVariableDeclAndInitExpr] (Int32,Int32) tuple = ...
208-
# 61| -1: [TypeMention] (int, int)
209-
# 61| 0: [LocalVariableAccess] access to local variable tuple
210-
# 61| 1: [TupleExpr] (..., ...)
211-
# 61| 0: [IntLiteral] 13
212-
# 61| 1: [IntLiteral] 14
213-
# 62| 8: [ExprStmt] ...;
214-
# 62| 0: [AssignExpr] ... = ...
215-
# 62| 0: [TupleExpr] (..., ...)
216-
# 62| 0: [PropertyCall] access to property Prop
217-
# 62| 1: [IndexerCall] access to indexer
218-
# 62| -1: [ThisAccess] this access
219-
# 62| 0: [IntLiteral] 15
220-
# 62| 1: [IntLiteral] 16
221-
# 62| 1: [LocalVariableAccess] access to local variable tuple
222-
# 66| 14: [Method] f6
223-
# 66| -1: [TypeMention] Void
209+
# 60| 0: [PropertyCall] access to property Prop
210+
# 60| 1: [IntLiteral] 7
211+
# 61| 5: [ExprStmt] ...;
212+
# 61| 0: [PostIncrExpr] ...++
213+
# 61| 0: [IndexerCall] access to indexer
214+
# 61| -1: [ThisAccess] this access
215+
# 61| 0: [IntLiteral] 8
216+
# 61| 1: [IntLiteral] 9
217+
# 62| 6: [ExprStmt] ...;
218+
# 62| 0: [AssignAddExpr] ... += ...
219+
# 62| 0: [IndexerCall] access to indexer
220+
# 62| -1: [ThisAccess] this access
221+
# 62| 0: [IntLiteral] 10
222+
# 62| 1: [IntLiteral] 11
223+
# 62| 1: [IntLiteral] 12
224+
# 63| 7: [LocalVariableDeclStmt] ... ...;
225+
# 63| 0: [LocalVariableDeclAndInitExpr] (Int32,Int32) tuple = ...
226+
# 63| -1: [TypeMention] (int, int)
227+
# 63| 0: [LocalVariableAccess] access to local variable tuple
228+
# 63| 1: [TupleExpr] (..., ...)
229+
# 63| 0: [IntLiteral] 13
230+
# 63| 1: [IntLiteral] 14
231+
# 64| 8: [ExprStmt] ...;
232+
# 64| 0: [AssignExpr] ... = ...
233+
# 64| 0: [TupleExpr] (..., ...)
234+
# 64| 0: [PropertyCall] access to property Prop
235+
# 64| 1: [IndexerCall] access to indexer
236+
# 64| -1: [ThisAccess] this access
237+
# 64| 0: [IntLiteral] 15
238+
# 64| 1: [IntLiteral] 16
239+
# 64| 1: [LocalVariableAccess] access to local variable tuple
240+
# 68| 14: [Method] f6
241+
# 68| -1: [TypeMention] Void
224242
#-----| 0: (Attributes)
225-
# 65| 1: [DefaultAttribute] [My(...)]
226-
# 65| -1: [TypeMention] MyAttribute
227-
# 65| 0: [BoolLiteral] false
228-
# 66| 4: [BlockStmt] {...}
229-
# 69| 15: [Method] f7
230-
# 69| -1: [TypeMention] Void
243+
# 67| 1: [DefaultAttribute] [My(...)]
244+
# 67| -1: [TypeMention] MyAttribute
245+
# 67| 0: [BoolLiteral] false
246+
# 68| 4: [BlockStmt] {...}
247+
# 71| 15: [Method] f7
248+
# 71| -1: [TypeMention] Void
231249
#-----| 0: (Attributes)
232-
# 68| 1: [DefaultAttribute] [My(...)]
233-
# 68| -1: [TypeMention] MyAttribute
234-
# 68| 0: [BoolLiteral] true
235-
# 68| 1: [StringLiteralUtf16] ""
236-
# 68| 2: [IntLiteral] 0
237-
# 69| 4: [BlockStmt] {...}
238-
# 72| [Class] MyAttribute
250+
# 70| 1: [DefaultAttribute] [My(...)]
251+
# 70| -1: [TypeMention] MyAttribute
252+
# 70| 0: [BoolLiteral] true
253+
# 70| 1: [StringLiteralUtf16] ""
254+
# 70| 2: [IntLiteral] 0
255+
# 71| 4: [BlockStmt] {...}
256+
# 73| 17: [Method] f8`1
257+
# 73| -1: [TypeMention] Void
258+
#-----| 1: (Type parameters)
259+
# 73| 0: [TypeParameter] T
260+
#-----| 2: (Parameters)
261+
# 73| 0: [Parameter] o
262+
# 73| -1: [TypeMention] int
263+
# 73| 1: [Parameter] args
264+
# 73| -1: [TypeMention] T[]
265 F438 +
# 73| 1: [TypeMention] T
266+
# 74| 4: [BlockStmt] {...}
267+
# 75| 0: [ExprStmt] ...;
268+
# 75| 0: [MethodCall] call to method f8`1
269+
# 75| 0: [IntLiteral] 0
270+
# 75| 1: [ArrayAccess] access to array element
271+
# 75| -1: [ParameterAccess] access to parameter args
272+
# 75| 0: [IntLiteral] 0
273+
# 75| 2: [ArrayAccess] access to array element
274+
# 75| -1: [ParameterAccess] access to parameter args
275+
# 75| 0: [IntLiteral] 1
276+
# 76| 1: [ExprStmt] ...;
277+
# 76| 0: [MethodCall] call to method f8`1
278+
# 76| 0: [IntLiteral] 0
279+
# 76| 1: [ArrayCreation] array creation of type T[]
280+
# 76| -2: [TypeMention] T[]
281+
# 76| 1: [TypeMention] T
282+
# 76| -1: [ArrayInitializer] { ..., ... }
283+
# 76| 0: [ArrayAccess] access to array element
284+
# 76| -1: [ParameterAccess] access to parameter args
285+
# 76| 0: [IntLiteral] 0
286+
# 76| 1: [ArrayAccess] access to array element
287+
# 76| -1: [ParameterAccess] access to parameter args
288+
# 76| 0: [IntLiteral] 1
289+
# 77| 2: [ExprStmt] ...;
290+
# 77| 0: [MethodCall] call to method f8`1
291+
# 77| 0: [IntLiteral] 0
292+
# 77| 1: [ParameterAccess] access to parameter args
293+
# 78| 3: [ExprStmt] ...;
294+
# 78| 0: [MethodCall] call to method f8`1
295+
# 78| 0: [ParameterAccess] access to parameter args
296+
# 78| 1: [IntLiteral] 0
297+
# 80| 4: [ExprStmt] ...;
298+
# 80| 0: [MethodCall] call to method f8<Double>
299+
# 80| 0: [IntLiteral] 0
300+
# 80| 1: [DoubleLiteral] 1.1
301+
# 80| 2: [DoubleLiteral] 2.2
302+
# 81| 5: [ExprStmt] ...;
303+
# 81| 0: [MethodCall] call to method f8<Double>
304+
# 81| 0: [IntLiteral] 0
305+
# 81| 1: [ArrayCreation] array creation of type Double[]
306+
# 81| -2: [TypeMention] Double[]
307+
# 81| 1: [TypeMention] double
308+
# 81| -1: [ArrayInitializer] { ..., ... }
309+
# 81| 0: [DoubleLiteral] 1.1
310+
# 81| 1: [DoubleLiteral] 2.2
311+
# 83| 6: [ExprStmt] ...;
312+
# 83| 0: [MethodCall] call to method f8<Double>
313+
# 83| 0: [IntLiteral] 0
314+
# 83| 1: [CastExpr] (...) ...
315+
# 83| 1: [IntLiteral] 1
316+
# 83| 2: [CastExpr] (...) ...
317+
# 83| 1: [IntLiteral] 2
318+
# 84| 7: [ExprStmt] ...;
319+
# 84| 0: [MethodCall] call to method f8<Double>
320+
# 84| 0: [IntLiteral] 0
321+
# 84| 1: [ArrayCreation] array creation of type Double[]
322+
# 84| -2: [TypeMention] Double[]
323+
# 84| 1: [TypeMention] double
324+
# 84| -1: [ArrayInitializer] { ..., ... }
325+
# 84| 0: [CastExpr] (...) ...
326+
# 84| 1: [IntLiteral] 1
327+
# 84| 1: [CastExpr] (...) ...
328+
# 84| 1: [IntLiteral] 2
329+
# 85| 8: [ExprStmt] ...;
330+
# 85| 0: [MethodCall] call to method f8<Double>
331+
# 85| 0: [IntLiteral] 0
332+
# 85| 1: [ArrayCreation] array creation of type Double[]
333+
# 85| -2: [TypeMention] Double[]
334+
# 85| 1: [TypeMention] double
335+
# 85| -1: [ArrayInitializer] { ..., ... }
336+
# 85| 0: [CastExpr] (...) ...
337+
# 85| 1: [IntLiteral] 1
338+
# 85| 1: [CastExpr] (...) ...
339+
# 85| 1: [IntLiteral] 2
340+
# 89| [Class] MyAttribute
239341
#-----| 3: (Base types)
240-
# 72| 0: [TypeMention] Attribute
241-
# 74| 4: [Field] x
242-
# 74| -1: [TypeMention] int
243-
# 75| 5: [Property] y
244-
# 75| -1: [TypeMention] string
245-
# 75| 3: [Getter] get_y
246-
# 75| 4: [Setter] set_y
342+
# 89| 0: [TypeMention] Attribute
343+
# 91| 4: [Field] x
344+
# 91| -1: [TypeMention] int
345+
# 92| 5: [Property] y
346+
# 92| -1: [TypeMention] string
347+
# 92| 3: [Getter] get_y
348+
# 92| 4: [Setter] set_y
247349
#-----| 2: (Parameters)
248-
# 75| 0: [Parameter] value
249-
# 76| 6: [InstanceConstructor] MyAttribute
350+
# 92| 0: [Parameter] value
351+
# 93| 6: [InstanceConstructor] MyAttribute
250352
#-----| 2: (Parameters)
251-
# 76| 0: [Parameter] b
252-
# 76| -1: [TypeMention] bool
253-
# 76| 4: [BlockStmt] {...}
353+
# 93| 0: [Parameter] b
354+
# 93| -1: [TypeMention] bool
355+
# 93| 4: [BlockStmt] {...}

0 commit comments

Comments
 (0)
0