Skip to content

Commit 8603609

Browse files
alexrfordhvitved
authored andcommitted
Update test output to account for for-loop -> each desugaring
1 parent e468434 commit 8603609

File tree

14 files changed

+474
-194
lines changed

14 files changed

+474
-194
lines changed

ruby/ql/test/library-tests/ast/Ast.expected

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#-----| [LocalVariableAccess] __synth__0__1
2+
#-----| [LocalVariableAccess] __synth__0__1
3+
#-----| [LocalVariableAccess] __synth__0__1
4+
#-----| [LocalVariableAccess] __synth__0__1
5+
#-----| [LocalVariableAccess] __synth__0__1
6+
#-----| [LocalVariableAccess] __synth__0__1
7+
#-----| [LocalVariableAccess] __synth__0__1
8+
#-----| [LocalVariableAccess] __synth__0__1
19
gems/Gemfile:
210
# 1| [Toplevel] Gemfile
311
# 1| getStmt: [MethodCall] call to source
@@ -365,15 +373,13 @@ calls/calls.rb:
365373
# 223| getReceiver: [ConstantReadAccess] X
366374
# 226| getStmt: [ForExpr] for ... in ...
367375
# 226| getPattern: [LocalVariableAccess] x
368-
# 226| <in>: [???] In
369376
# 226| getValue: [MethodCall] call to bar
370377
# 226| getReceiver: [Self, SelfVariableAccess] self
371378
# 226| getBody: [StmtSequence] do ...
372379
# 227| getStmt: [MethodCall] call to baz
373380
# 227| getReceiver: [Self, SelfVariableAccess] self
374381
# 229| getStmt: [ForExpr] for ... in ...
375382
# 229| getPattern: [LocalVariableAccess] x
376-
# 229| <in>: [???] In
377383
# 229| getValue: [MethodCall] call to bar
378384
# 229| getReceiver: [ConstantReadAccess] X
379385
# 229| getBody: [StmtSequence] do ...
@@ -655,6 +661,26 @@ calls/calls.rb:
655661
# 336| getReceiver: [Self, SelfVariableAccess] self
656662
# 336| getArgument: [LocalVariableAccess] b
657663
# 336| getArgument: [ForwardedArguments] ...
664+
# 340| getStmt: [ForExpr] for ... in ...
665+
# 340| getPattern: [TuplePattern] (..., ...)
666+
# 340| getElement: [LocalVariableAccess] x
667+
# 340| getElement: [LocalVariableAccess] y
668+
# 340| getElement: [LocalVariableAccess] z
669+
# 340| getValue: [ArrayLiteral] [...]
670+
# 340| getElement: [ArrayLiteral] [...]
671+
# 340| getElement: [IntegerLiteral] 1
672+
# 340| getElement: [IntegerLiteral] 2
673+
# 340| getElement: [IntegerLiteral] 3
674+
# 340| getElement: [ArrayLiteral] [...]
675+
# 340| getElement: [IntegerLiteral] 4
676+
# 340| getElement: [IntegerLiteral] 5
677+
# 340| getElement: [IntegerLiteral] 6
678+
# 340| getBody: [StmtSequence] do ...
679+
# 341| getStmt: [MethodCall] call to foo
680+
# 341| getReceiver: [Self, SelfVariableAccess] self
681+
# 341| getArgument: [LocalVariableAccess] x
682+
# 341| getArgument: [LocalVariableAccess] y
683+
# 341| getArgument: [LocalVariableAccess] z
658684
control/cases.rb:
659685
# 1| [Toplevel] cases.rb
660686
# 2| getStmt: [AssignExpr] ... = ...
@@ -1422,7 +1448,6 @@ control/loops.rb:
14221448
# 6| getAnOperand/getRightOperand: [IntegerLiteral] 0
14231449
# 9| getStmt: [ForExpr] for ... in ...
14241450
# 9| getPattern: [LocalVariableAccess] n
1425-
# 9| <in>: [???] In
14261451
# 9| getValue: [RangeLiteral] _ .. _
14271452
# 9| getBegin: [IntegerLiteral] 1
14281453
# 9| getEnd: [IntegerLiteral] 10
@@ -1435,7 +1460,6 @@ control/loops.rb:
14351460
# 11| getAnOperand/getRightOperand: [LocalVariableAccess] n
14361461
# 16| getStmt: [ForExpr] for ... in ...
14371462
# 16| getPattern: [LocalVariableAccess] n
1438-
# 16| <in>: [???] In
14391463
# 16| getValue: [RangeLiteral] _ .. _
14401464
# 16| getBegin: [IntegerLiteral] 1
14411465
# 16| getEnd: [IntegerLiteral] 10
@@ -1450,7 +1474,6 @@ control/loops.rb:
14501474
# 22| getPattern: [TuplePattern] (..., ...)
14511475
# 22| getElement: [LocalVariableAccess] key
14521476
# 22| getElement: [LocalVariableAccess] value
1453-
# 22| <in>: [???] In
14541477
# 22| getValue: [HashLiteral] {...}
14551478
# 22| getElement: [Pair] Pair
14561479
# 22| getKey: [SymbolLiteral] :foo
@@ -1469,7 +1492,6 @@ control/loops.rb:
14691492
# 28| getPattern: [TuplePattern] (..., ...)
14701493
# 28| getElement: [LocalVariableAccess] key
14711494
# 28| getElement: [LocalVariableAccess] value
1472-
# 28| <in>: [???] In
14731495
# 28| getValue: [HashLiteral] {...}
14741496
# 28| getElement: [Pair] Pair
14751497
# 28| getKey: [SymbolLiteral] :foo
@@ -2140,7 +2162,6 @@ erb/template.html.erb:
21402162
# 25| getAnOperand/getRightOperand: [StringLiteral] ""
21412163
# 27| getStmt: [ForExpr] for ... in ...
21422164
# 27| getPattern: [LocalVariableAccess] x
2143-
# 27| <in>: [???] In
21442165
# 27| getValue: [ArrayLiteral] [...]
21452166
# 27| getElement: [StringLiteral] "foo"
21462167
# 27| getComponent: [StringTextComponent] foo

ruby/ql/test/library-tests/ast/AstDesugar.expected

Lines changed: 221 additions & 57 deletions
Large diffs are not rendered by default.

ruby/ql/test/library-tests/ast/ValueText.expected

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
| calls/calls.rb:320:31:320:31 | 1 | 1 |
5757
| calls/calls.rb:320:37:320:37 | 2 | 2 |
5858
| calls/calls.rb:328:31:328:37 | "error" | error |
59+
| calls/calls.rb:340:5:340:5 | 0 | 0 |
60+
| calls/calls.rb:340:8:340:8 | 1 | 1 |
61+
| calls/calls.rb:340:11:340:11 | 2 | 2 |
62+
| calls/calls.rb:340:18:340:18 | 1 | 1 |
63+
| calls/calls.rb:340:20:340:20 | 2 | 2 |
64+
| calls/calls.rb:340:22:340:22 | 3 | 3 |
65+
| calls/calls.rb:340:27:340:27 | 4 | 4 |
66+
| calls/calls.rb:340:29:340:29 | 5 | 5 |
67+
| calls/calls.rb:340:31:340:31 | 6 | 6 |
5968
| constants/constants.rb:3:19:3:27 | "const_a" | const_a |
6069
| constants/constants.rb:6:15:6:23 | "const_b" | const_b |
6170
| constants/constants.rb:17:12:17:18 | "Hello" | Hello |
@@ -148,38 +157,38 @@
148157
| control/loops.rb:6:5:6:5 | 0 | 0 |
149158
| control/loops.rb:9:10:9:10 | 1 | 1 |
150159
| control/loops.rb:9:13:9:14 | 10 | 10 |
160+
| control/loops.rb:10:5:10:7 | sum | 0 |
151161
| control/loops.rb:16:10:16:10 | 1 | 1 |
152162
| control/loops.rb:16:13:16:14 | 10 | 10 |
163+
| control/loops.rb:22:5:22:7 | 0 | 0 |
164+
| control/loops.rb:22:10:22:14 | 1 | 1 |
153165
| control/loops.rb:22:20:22:22 | :foo | foo |
154166
| control/loops.rb:22:25:22:25 | 0 | 0 |
155167
| control/loops.rb:22:28:22:30 | :bar | bar |
156168
| control/loops.rb:22:33:22:33 | 1 | 1 |
169+
| control/loops.rb:28:6:28:8 | 0 | 0 |
170+
| control/loops.rb:28:11:28:15 | 1 | 1 |
157171
| control/loops.rb:28:22:28:24 | :foo | foo |
158172
| control/loops.rb:28:27:28:27 | 0 | 0 |
159173
| control/loops.rb:28:30:28:32 | :bar | bar |
160174
| control/loops.rb:28:35:28:35 | 1 | 1 |
161-
| control/loops.rb:35:11:35:11 | y | 0 |
162175
| control/loops.rb:36:8:36:8 | 1 | 1 |
163176
| control/loops.rb:37:8:37:8 | 1 | 1 |
164-
| control/loops.rb:42:11:42:11 | y | 0 |
165177
| control/loops.rb:43:8:43:8 | 1 | 1 |
166178
| control/loops.rb:44:8:44:8 | 2 | 2 |
167179
| control/loops.rb:48:6:48:6 | 1 | 1 |
168-
| control/loops.rb:48:14:48:14 | y | 0 |
169-
| control/loops.rb:51:12:51:12 | y | 0 |
170180
| control/loops.rb:52:8:52:8 | 1 | 1 |
171181
| control/loops.rb:53:8:53:8 | 1 | 1 |
172-
| control/loops.rb:57:11:57:11 | y | 0 |
173182
| control/loops.rb:58:8:58:8 | 1 | 1 |
174183
| control/loops.rb:59:8:59:8 | 4 | 4 |
175184
| control/loops.rb:63:6:63:6 | 1 | 1 |
176185
| control/loops.rb:63:19:63:19 | 0 | 0 |
177-
| control/loops.rb:66:11:66:11 | y | 0 |
178186
| erb/template.html.erb:19:5:19:17 | "hello world" | hello world |
179187
| erb/template.html.erb:25:9:25:10 | "" | |
180188
| erb/template.html.erb:27:16:27:20 | "foo" | foo |
181189
| erb/template.html.erb:27:23:27:27 | "bar" | bar |
182190
| erb/template.html.erb:27:30:27:34 | "baz" | baz |
191+
| erb/template.html.erb:28:11:28:12 | xs | |
183192
| gems/Gemfile:1:8:1:29 | "https://rubygems.org" | https://rubygems.org |
184193
| gems/Gemfile:3:5:3:13 | "foo_gem" | foo_gem |
185194
| gems/Gemfile:3:16:3:23 | "~> 2.0" | ~> 2.0 |

ruby/ql/test/library-tests/ast/calls/arguments.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ splatExpr
66
| calls.rb:271:5:271:11 | * ... | calls.rb:271:6:271:11 | call to bar |
77
| calls.rb:316:31:316:42 | * ... | calls.rb:316:31:316:42 | [...] |
88
| calls.rb:317:14:317:22 | * ... | calls.rb:317:14:317:22 | [...] |
9+
| calls.rb:340:1:342:3 | * ... | calls.rb:340:1:342:3 | __synth__0__1 |
910
hashSplatExpr
1011
| calls.rb:274:5:274:9 | ** ... | calls.rb:274:7:274:9 | call to bar |
1112
| calls.rb:275:5:275:12 | ** ... | calls.rb:275:7:275:12 | call to bar |

ruby/ql/test/library-tests/ast/calls/calls.expected

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ callsWithArguments
9090
| calls.rb:332:3:332:12 | call to super | super | 0 | calls.rb:332:9:332:11 | ... |
9191
| calls.rb:336:3:336:13 | call to bar | bar | 0 | calls.rb:336:7:336:7 | b |
9292
| calls.rb:336:3:336:13 | call to bar | bar | 1 | calls.rb:336:10:336:12 | ... |
93+
| calls.rb:340:5:340:5 | call to [] | [] | 0 | calls.rb:340:5:340:5 | 0 |
94+
| calls.rb:340:8:340:8 | call to [] | [] | 0 | calls.rb:340:8:340:8 | 1 |
95+
| calls.rb:340:11:340:11 | call to [] | [] | 0 | calls.rb:340:11:340:11 | 2 |
96+
| calls.rb:340:16:340:33 | call to [] | [] | 0 | calls.rb:340:17:340:23 | [...] |
97+
| calls.rb:340:16:340:33 | call to [] | [] | 1 | calls.rb:340:26:340:32 | [...] |
98+
| calls.rb:340:17:340:23 | call to [] | [] | 0 | calls.rb:340:18:340:18 | 1 |
99+
| calls.rb:340:17:340:23 | call to [] | [] | 1 | calls.rb:340:20:340:20 | 2 |
100+
| calls.rb:340:17:340:23 | call to [] | [] | 2 | calls.rb:340:22:340:22 | 3 |
101+
| calls.rb:340:26:340:32 | call to [] | [] | 0 | calls.rb:340:27:340:27 | 4 |
102+
| calls.rb:340:26:340:32 | call to [] | [] | 1 | calls.rb:340:29:340:29 | 5 |
103+
| calls.rb:340:26:340:32 | call to [] | [] | 2 | calls.rb:340:31:340:31 | 6 |
104+
| calls.rb:341:3:341:13 | call to foo | foo | 0 | calls.rb:341:7:341:7 | x |
105+
| calls.rb:341:3:341:13 | call to foo | foo | 1 | calls.rb:341:10:341:10 | y |
106+
| calls.rb:341:3:341:13 | call to foo | foo | 2 | calls.rb:341:13:341:13 | z |
93107
callsWithReceiver
94108
| calls.rb:2:1:2:5 | call to foo | calls.rb:2:1:2:5 | self |
95109
| calls.rb:5:1:5:10 | call to bar | calls.rb:5:1:5:3 | Foo |
@@ -214,8 +228,10 @@ callsWithReceiver
214228
| calls.rb:222:11:222:13 | call to foo | calls.rb:222:11:222:13 | self |
215229
| calls.rb:223:1:223:6 | call to bar | calls.rb:223:1:223:1 | X |
216230
| calls.rb:223:14:223:19 | call to foo | calls.rb:223:14:223:14 | X |
231+
| calls.rb:226:1:228:3 | call to each | calls.rb:226:10:226:12 | call to bar |
217232
| calls.rb:226:10:226:12 | call to bar | calls.rb:226:10:226:12 | self |
218233
| calls.rb:227:3:227:5 | call to baz | calls.rb:227:3:227:5 | self |
234+
| calls.rb:229:1:231:3 | call to each | calls.rb:229:10:229:15 | call to bar |
219235
| calls.rb:229:10:229:15 | call to bar | calls.rb:229:10:229:10 | X |
220236
| calls.rb:230:3:230:8 | call to baz | calls.rb:230:3:230:3 | X |
221237
| calls.rb:234:1:234:3 | call to foo | calls.rb:234:1:234:3 | self |
@@ -328,16 +344,28 @@ callsWithReceiver
328344
| calls.rb:328:13:328:15 | call to bar | calls.rb:328:13:328:15 | self |
329345
| calls.rb:328:25:328:37 | call to print | calls.rb:328:25:328:37 | self |
330346
| calls.rb:336:3:336:13 | call to bar | calls.rb:336:3:336:13 | self |
347+
| calls.rb:340:1:342:3 | * ... | calls.rb:340:1:342:3 | __synth__0__1 |
348+
| calls.rb:340:1:342:3 | call to each | calls.rb:340:16:340:33 | [...] |
349+
| calls.rb:340:5:340:5 | call to [] | calls.rb:340:5:340:5 | __synth__0__1 |
350+
| calls.rb:340:8:340:8 | call to [] | calls.rb:340:8:340:8 | __synth__0__1 |
351+
| calls.rb:340:11:340:11 | call to [] | calls.rb:340:11:340:11 | __synth__0__1 |
352+
| calls.rb:340:16:340:33 | call to [] | calls.rb:340:16:340:33 | Array |
353+
| calls.rb:340:17:340:23 | call to [] | calls.rb:340:17:340:23 | Array |
354+
| calls.rb:340:26:340:32 | call to [] | calls.rb:340:26:340:32 | Array |
355+
| calls.rb:341:3:341:13 | call to foo | calls.rb:341:3:341:13 | self |
331356
callsWithBlock
332357
| calls.rb:17:1:17:17 | call to foo | calls.rb:17:5:17:17 | { ... } |
333358
| calls.rb:20:1:22:3 | call to foo | calls.rb:20:5:22:3 | do ... end |
334359
| calls.rb:25:1:27:3 | call to bar | calls.rb:25:16:27:3 | do ... end |
335360
| calls.rb:92:1:92:21 | call to foo | calls.rb:92:7:92:21 | { ... } |
336361
| calls.rb:95:1:98:3 | call to foo | calls.rb:95:7:98:3 | do ... end |
362+
| calls.rb:226:1:228:3 | call to each | calls.rb:226:1:228:3 | { ... } |
363+
| calls.rb:229:1:231:3 | call to each | calls.rb:229:1:231:3 | { ... } |
337364
| calls.rb:290:5:290:23 | call to super | calls.rb:290:11:290:23 | { ... } |
338365
| calls.rb:291:5:291:26 | call to super | calls.rb:291:11:291:26 | do ... end |
339366
| calls.rb:292:5:292:30 | call to super | calls.rb:292:16:292:30 | { ... } |
340367
| calls.rb:293:5:293:33 | call to super | calls.rb:293:16:293:33 | do ... end |
368+
| calls.rb:340:1:342:3 | call to each | calls.rb:340:1:342:3 | { ... } |
341369
yieldCalls
342370
| calls.rb:31:3:31:7 | yield ... |
343371
| calls.rb:36:3:36:16 | yield ... |

ruby/ql/test/library-tests/ast/calls/calls.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,8 @@ def foo(...)
335335
def foo(a, b, ...)
336336
bar(b, ...)
337337
end
338+
339+
# for loop over nested array
340+
for x, y, z in [[1,2,3], [4,5,6]]
341+
foo x, y, z
342+
end

0 commit comments

Comments
 (0)