Skip to content

Commit b065d2d

Browse files
authored
Merge pull request #10705 from hvitved/ruby/singleton-overrides
Ruby: Take overrides into account for singleton methods defined on modules
2 parents 0d98eba + 69fc599 commit b065d2d

File tree

7 files changed

+1045
-1002
lines changed

7 files changed

+1045
-1002
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowDispatch.qll

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ private module Cached {
389389
// ```
390390
exists(DataFlow::Node sourceNode, Module m |
391391
flowsToMethodCall(call, sourceNode, method) and
392-
singletonMethodOnModule(result, method, m)
392+
result = lookupSingletonMethod(m, method)
393393
|
394394
// ```rb
395395
// def C.singleton; end # <- result
@@ -725,14 +725,37 @@ private predicate singletonMethodOnModule(MethodBase method, string name, Module
725725
selfInModule(object.(SelfVariableReadAccess).getVariable(), m)
726726
)
727727
or
728-
flowsToSingletonMethodObject(trackModuleAccess(m), method, name)
728+
exists(DataFlow::LocalSourceNode sourceNode |
729+
m = resolveConstantReadAccess(sourceNode.asExpr().getExpr()) and
730+
flowsToSingletonMethodObject(sourceNode, method, name)
731+
)
729732
or
730733
exists(Module other |
731734
extendCallModule(m, other) and
732735
method = lookupMethod(other, name)
733736
)
734737
}
735738

739+
/**
740+
* Holds if `method` is a singleton method named `name`, defined on module
741+
* `m`, or any transitive base class of `m`.
742+
*/
743+
pragma[nomagic]
744+
private MethodBase lookupSingletonMethod(Module m, string name) {
745+
singletonMethodOnModule(result, name, m)
746+
or
747+
// cannot be part of `singletonMethodOnModule` because it would introduce
748+
// negative recursion below
749+
exists(DataFlow::LocalSourceNode sourceNode |
750+
sourceNode = trackModuleAccess(m) and
751+
not m = resolveConstantReadAccess(sourceNode.asExpr().getExpr()) and
752+
flowsToSingletonMethodObject(sourceNode, result, name)
753+
)
754+
or
755+
not singletonMethodOnModule(_, name, m) and
756+
result = lookupSingletonMethod(m.getSuperClass(), name)
757+
}
758+
736759
/**
737760
* Holds if `method` is a singleton method named `name`, defined on expression
738761
* `object`, where `object` is not likely to resolve to a module:

ruby/ql/test/library-tests/modules/ancestors.expected

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,25 @@ calls.rb:
8989
# 377| SingletonOverride1
9090
#-----| super -> Object
9191

92-
# 402| SingletonOverride2
92+
# 404| SingletonOverride2
9393
#-----| super -> SingletonOverride1
9494

95-
# 417| ConditionalInstanceMethods
95+
# 421| ConditionalInstanceMethods
9696
#-----| super -> Object
9797

98-
# 480| ExtendSingletonMethod
98+
# 484| ExtendSingletonMethod
9999

100-
# 490| ExtendSingletonMethod2
100+
# 494| ExtendSingletonMethod2
101101

102-
# 496| ExtendSingletonMethod3
102+
# 500| ExtendSingletonMethod3
103103

104-
# 509| ProtectedMethodInModule
104+
# 513| ProtectedMethodInModule
105105

106-
# 515| ProtectedMethods
106+
# 519| ProtectedMethods
107107
#-----| super -> Object
108108
#-----| include -> ProtectedMethodInModule
109109

110-
# 534| ProtectedMethodsSub
110+
# 538| ProtectedMethodsSub
111111
#-----| super -> ProtectedMethods
112112

113113
hello.rb:

ruby/ql/test/library-tests/modules/callgraph.expected

Lines changed: 113 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -148,67 +148,73 @@ getTarget
148148
| calls.rb:375:1:375:11 | call to instance | calls.rb:368:5:370:7 | instance |
149149
| calls.rb:380:13:380:48 | call to puts | calls.rb:102:5:102:30 | puts |
150150
| calls.rb:384:13:384:22 | call to singleton1 | calls.rb:379:9:381:11 | singleton1 |
151-
| calls.rb:384:13:384:22 | call to singleton1 | calls.rb:404:9:406:11 | singleton1 |
151+
| calls.rb:384:13:384:22 | call to singleton1 | calls.rb:406:9:408:11 | singleton1 |
152152
| calls.rb:389:9:389:44 | call to puts | calls.rb:102:5:102:30 | puts |
153153
| calls.rb:393:9:393:18 | call to singleton2 | calls.rb:388:5:390:7 | singleton2 |
154-
| calls.rb:393:9:393:18 | call to singleton2 | calls.rb:409:5:411:7 | singleton2 |
154+
| calls.rb:393:9:393:18 | call to singleton2 | calls.rb:411:5:413:7 | singleton2 |
155155
| calls.rb:396:5:396:14 | call to singleton2 | calls.rb:388:5:390:7 | singleton2 |
156-
| calls.rb:399:1:399:34 | call to call_singleton1 | calls.rb:383:9:385:11 | call_singleton1 |
157-
| calls.rb:400:1:400:34 | call to call_singleton2 | calls.rb:392:5:394:7 | call_singleton2 |
158-
| calls.rb:405:13:405:48 | call to puts | calls.rb:102:5:102:30 | puts |
159-
| calls.rb:410:9:410:44 | call to puts | calls.rb:102:5:102:30 | puts |
160-
| calls.rb:420:13:420:48 | call to puts | calls.rb:102:5:102:30 | puts |
161-
| calls.rb:425:9:425:44 | call to puts | calls.rb:102:5:102:30 | puts |
162-
| calls.rb:428:13:428:48 | call to puts | calls.rb:102:5:102:30 | puts |
163-
| calls.rb:431:17:431:52 | call to puts | calls.rb:102:5:102:30 | puts |
164-
| calls.rb:439:9:443:11 | call to new | calls.rb:117:5:117:16 | new |
165-
| calls.rb:439:9:443:15 | call to new | calls.rb:117:5:117:16 | new |
166-
| calls.rb:441:17:441:40 | call to puts | calls.rb:102:5:102:30 | puts |
167-
| calls.rb:447:1:447:30 | call to new | calls.rb:117:5:117:16 | new |
168-
| calls.rb:447:1:447:33 | call to m1 | calls.rb:419:9:421:11 | m1 |
169-
| calls.rb:448:1:448:30 | call to new | calls.rb:117:5:117:16 | new |
170-
| calls.rb:449:1:449:30 | call to new | calls.rb:117:5:117:16 | new |
171-
| calls.rb:449:1:449:33 | call to m2 | calls.rb:424:5:436:7 | m2 |
172-
| calls.rb:450:1:450:30 | call to new | calls.rb:117:5:117:16 | new |
156+
| calls.rb:399:1:399:29 | call to singleton1 | calls.rb:379:9:381:11 | singleton1 |
157+
| calls.rb:400:1:400:29 | call to singleton2 | calls.rb:388:5:390:7 | singleton2 |
158+
| calls.rb:401:1:401:34 | call to call_singleton1 | calls.rb:383:9:385:11 | call_singleton1 |
159+
| calls.rb:402:1:402:34 | call to call_singleton2 | calls.rb:392:5:394:7 | call_singleton2 |
160+
| calls.rb:407:13:407:48 | call to puts | calls.rb:102:5:102:30 | puts |
161+
| calls.rb:412:9:412:44 | call to puts | calls.rb:102:5:102:30 | puts |
162+
| calls.rb:416:1:416:29 | call to singleton1 | calls.rb:406:9:408:11 | singleton1 |
163+
| calls.rb:417:1:417:29 | call to singleton2 | calls.rb:411:5:413:7 | singleton2 |
164+
| calls.rb:418:1:418:34 | call to call_singleton1 | calls.rb:383:9:385:11 | call_singleton1 |
165+
| calls.rb:419:1:419:34 | call to call_singleton2 | calls.rb:392:5:394:7 | call_singleton2 |
166+
| calls.rb:424:13:424:48 | call to puts | calls.rb:102:5:102:30 | puts |
167+
| calls.rb:429:9:429:44 | call to puts | calls.rb:102:5:102:30 | puts |
168+
| calls.rb:432:13:432:48 | call to puts | calls.rb:102:5:102:30 | puts |
169+
| calls.rb:435:17:435:52 | call to puts | calls.rb:102:5:102:30 | puts |
170+
| calls.rb:443:9:447:11 | call to new | calls.rb:117:5:117:16 | new |
171+
| calls.rb:443:9:447:15 | call to new | calls.rb:117:5:117:16 | new |
172+
| calls.rb:445:17:445:40 | call to puts | calls.rb:102:5:102:30 | puts |
173173
| calls.rb:451:1:451:30 | call to new | calls.rb:117:5:117:16 | new |
174+
| calls.rb:451:1:451:33 | call to m1 | calls.rb:423:9:425:11 | m1 |
174175
| calls.rb:452:1:452:30 | call to new | calls.rb:117:5:117:16 | new |
175-
| calls.rb:454:27:472:3 | call to new | calls.rb:117:5:117:16 | new |
176-
| calls.rb:457:13:457:22 | call to puts | calls.rb:102:5:102:30 | puts |
177-
| calls.rb:461:5:465:7 | call to new | calls.rb:117:5:117:16 | new |
178-
| calls.rb:461:5:465:11 | call to new | calls.rb:117:5:117:16 | new |
179-
| calls.rb:463:13:463:22 | call to puts | calls.rb:102:5:102:30 | puts |
180-
| calls.rb:469:13:469:27 | call to puts | calls.rb:102:5:102:30 | puts |
181-
| calls.rb:474:1:474:27 | call to new | calls.rb:117:5:117:16 | new |
182-
| calls.rb:475:1:475:27 | call to new | calls.rb:117:5:117:16 | new |
183-
| calls.rb:476:1:476:27 | call to new | calls.rb:117:5:117:16 | new |
184-
| calls.rb:477:1:477:27 | call to new | calls.rb:117:5:117:16 | new |
176+
| calls.rb:453:1:453:30 | call to new | calls.rb:117:5:117:16 | new |
177+
| calls.rb:453:1:453:33 | call to m2 | calls.rb:428:5:440:7 | m2 |
178+
| calls.rb:454:1:454:30 | call to new | calls.rb:117:5:117:16 | new |
179+
| calls.rb:455:1:455:30 | call to new | calls.rb:117:5:117:16 | new |
180+
| calls.rb:456:1:456:30 | call to new | calls.rb:117:5:117:16 | new |
181+
| calls.rb:458:27:476:3 | call to new | calls.rb:117:5:117:16 | new |
182+
| calls.rb:461:13:461:22 | call to puts | calls.rb:102:5:102:30 | puts |
183+
| calls.rb:465:5:469:7 | call to new | calls.rb:117:5:117:16 | new |
184+
| calls.rb:465:5:469:11 | call to new | calls.rb:117:5:117:16 | new |
185+
| calls.rb:467:13:467:22 | call to puts | calls.rb:102:5:102:30 | puts |
186+
| calls.rb:473:13:473:27 | call to puts | calls.rb:102:5:102:30 | puts |
185187
| calls.rb:478:1:478:27 | call to new | calls.rb:117:5:117:16 | new |
186-
| calls.rb:488:1:488:31 | call to singleton | calls.rb:481:5:483:7 | singleton |
187-
| calls.rb:494:1:494:32 | call to singleton | calls.rb:481:5:483:7 | singleton |
188-
| calls.rb:501:1:501:32 | call to singleton | calls.rb:481:5:483:7 | singleton |
189-
| calls.rb:507:1:507:13 | call to singleton | calls.rb:481:5:483:7 | singleton |
190-
| calls.rb:516:5:516:35 | call to include | calls.rb:108:5:110:7 | include |
191-
| calls.rb:519:9:519:35 | call to puts | calls.rb:102:5:102:30 | puts |
192-
| calls.rb:523:9:523:11 | call to foo | calls.rb:510:15:512:7 | foo |
193-
| calls.rb:524:9:524:11 | call to bar | calls.rb:518:15:520:7 | bar |
194-
| calls.rb:525:9:525:28 | call to new | calls.rb:117:5:117:16 | new |
195-
| calls.rb:525:9:525:32 | call to foo | calls.rb:510:15:512:7 | foo |
196-
| calls.rb:526:9:526:28 | call to new | calls.rb:117:5:117:16 | new |
197-
| calls.rb:526:9:526:32 | call to bar | calls.rb:518:15:520:7 | bar |
198-
| calls.rb:530:1:530:20 | call to new | calls.rb:117:5:117:16 | new |
199-
| calls.rb:531:1:531:20 | call to new | calls.rb:117:5:117:16 | new |
200-
| calls.rb:532:1:532:20 | call to new | calls.rb:117:5:117:16 | new |
201-
| calls.rb:532:1:532:24 | call to baz | calls.rb:522:5:527:7 | baz |
202-
| calls.rb:536:9:536:11 | call to foo | calls.rb:510:15:512:7 | foo |
203-
| calls.rb:537:9:537:31 | call to new | calls.rb:117:5:117:16 | new |
204-
| calls.rb:537:9:537:35 | call to foo | calls.rb:510:15:512:7 | foo |
205-
| calls.rb:541:1:541:23 | call to new | calls.rb:117:5:117:16 | new |
206-
| calls.rb:542:1:542:23 | call to new | calls.rb:117:5:117:16 | new |
207-
| calls.rb:543:1:543:23 | call to new | calls.rb:117:5:117:16 | new |
208-
| calls.rb:543:1:543:27 | call to baz | calls.rb:535:5:538:7 | baz |
209-
| calls.rb:545:2:545:6 | call to new | calls.rb:117:5:117:16 | new |
210-
| calls.rb:545:20:545:24 | call to baz | calls.rb:51:5:57:7 | baz |
211-
| calls.rb:546:26:546:37 | call to capitalize | calls.rb:97:5:97:23 | capitalize |
188+
| calls.rb:479:1:479:27 | call to new | calls.rb:117:5:117:16 | new |
189+
| calls.rb:480:1:480:27 | call to new | calls.rb:117:5:117:16 | new |
190+
| calls.rb:481:1:481:27 | call to new | calls.rb:117:5:117:16 | new |
191+
| calls.rb:482:1:482:27 | call to new | calls.rb:117:5:117:16 | new |
192+
| calls.rb:492:1:492:31 | call to singleton | calls.rb:485:5:487:7 | singleton |
193+
| calls.rb:498:1:498:32 | call to singleton | calls.rb:485:5:487:7 | singleton |
194+
| calls.rb:505:1:505:32 | call to singleton | calls.rb:485:5:487:7 | singleton |
195+
| calls.rb:511:1:511:13 | call to singleton | calls.rb:485:5:487:7 | singleton |
196+
| calls.rb:520:5:520:35 | call to include | calls.rb:108:5:110:7 | include |
197+
| calls.rb:523:9:523:35 | call to puts | calls.rb:102:5:102:30 | puts |
198+
| calls.rb:527:9:527:11 | call to foo | calls.rb:514:15:516:7 | foo |
199+
| calls.rb:528:9:528:11 | call to bar | calls.rb:522:15:524:7 | bar |
200+
| calls.rb:529:9:529:28 | call to new | calls.rb:117:5:117:16 | new |
201+
| calls.rb:529:9:529:32 | call to foo | calls.rb:514:15:516:7 | foo |
202+
| calls.rb:530:9:530:28 | call to new | calls.rb:117:5:117:16 | new |
203+
| calls.rb:530:9:530:32 | call to bar | calls.rb:522:15:524:7 | bar |
204+
| calls.rb:534:1:534:20 | call to new | calls.rb:117:5:117:16 | new |
205+
| calls.rb:535:1:535:20 | call to new | calls.rb:117:5:117:16 | new |
206+
| calls.rb:536:1:536:20 | call to new | calls.rb:117:5:117:16 | new |
207+
| calls.rb:536:1:536:24 | call to baz | calls.rb:526:5:531:7 | baz |
208+
| calls.rb:540:9:540:11 | call to foo | calls.rb:514:15:516:7 | foo |
209+
| calls.rb:541:9:541:31 | call to new | calls.rb:117:5:117:16 | new |
210+
| calls.rb:541:9:541:35 | call to foo | calls.rb:514:15:516:7 | foo |
211+
| calls.rb:545:1:545:23 | call to new | calls.rb:117:5:117:16 | new |
212+
| calls.rb:546:1:546:23 | call to new | calls.rb:117:5:117:16 | new |
213+
| calls.rb:547:1:547:23 | call to new | calls.rb:117:5:117:16 | new |
214+
| calls.rb:547:1:547:27 | call to baz | calls.rb:539:5:542:7 | baz |
215+
| calls.rb:549:2:549:6 | call to new | calls.rb:117:5:117:16 | new |
216+
| calls.rb:549:20:549:24 | call to baz | calls.rb:51:5:57:7 | baz |
217+
| calls.rb:550:26:550:37 | call to capitalize | calls.rb:97:5:97:23 | capitalize |
212218
| hello.rb:12:5:12:24 | call to include | calls.rb:108:5:110:7 | include |
213219
| hello.rb:14:16:14:20 | call to hello | hello.rb:2:5:4:7 | hello |
214220
| hello.rb:20:16:20:20 | call to super | hello.rb:13:5:15:7 | message |
@@ -286,46 +292,44 @@ unresolvedCall
286292
| calls.rb:274:1:274:14 | call to singleton_g |
287293
| calls.rb:276:1:276:14 | call to singleton_g |
288294
| calls.rb:313:9:313:20 | call to instance |
289-
| calls.rb:414:1:414:34 | call to call_singleton1 |
290-
| calls.rb:415:1:415:34 | call to call_singleton2 |
291-
| calls.rb:418:8:418:13 | call to rand |
292-
| calls.rb:418:8:418:17 | ... > ... |
293-
| calls.rb:435:9:435:10 | call to m3 |
294-
| calls.rb:438:8:438:13 | call to rand |
295-
| calls.rb:438:8:438:17 | ... > ... |
296-
| calls.rb:439:9:443:18 | call to m5 |
297-
| calls.rb:448:1:448:33 | call to m3 |
298-
| calls.rb:450:1:450:33 | call to m3 |
299-
| calls.rb:451:1:451:33 | call to m4 |
300-
| calls.rb:452:1:452:33 | call to m5 |
301-
| calls.rb:455:5:455:11 | call to [] |
302-
| calls.rb:455:5:459:7 | call to each |
303-
| calls.rb:461:5:465:15 | call to bar |
304-
| calls.rb:467:5:467:11 | call to [] |
305-
| calls.rb:467:5:471:7 | call to each |
306-
| calls.rb:468:9:470:11 | call to define_method |
307-
| calls.rb:474:1:474:31 | call to foo |
308-
| calls.rb:475:1:475:31 | call to bar |
309-
| calls.rb:476:1:476:33 | call to baz_0 |
310-
| calls.rb:477:1:477:33 | call to baz_1 |
311-
| calls.rb:478:1:478:33 | call to baz_2 |
312-
| calls.rb:482:9:482:46 | call to puts |
313-
| calls.rb:485:5:485:15 | call to extend |
314-
| calls.rb:491:5:491:32 | call to extend |
315-
| calls.rb:499:1:499:51 | call to extend |
316-
| calls.rb:504:1:504:13 | call to singleton |
317-
| calls.rb:505:1:505:32 | call to extend |
318-
| calls.rb:510:5:512:7 | call to protected |
319-
| calls.rb:511:9:511:42 | call to puts |
320-
| calls.rb:518:5:520:7 | call to protected |
321-
| calls.rb:530:1:530:24 | call to foo |
322-
| calls.rb:531:1:531:24 | call to bar |
323-
| calls.rb:541:1:541:27 | call to foo |
324-
| calls.rb:542:1:542:27 | call to bar |
325-
| calls.rb:545:1:545:7 | call to [] |
326-
| calls.rb:545:1:545:26 | call to each |
327-
| calls.rb:546:1:546:13 | call to [] |
328-
| calls.rb:546:1:546:39 | call to each |
295+
| calls.rb:422:8:422:13 | call to rand |
296+
| calls.rb:422:8:422:17 | ... > ... |
297+
| calls.rb:439:9:439:10 | call to m3 |
298+
| calls.rb:442:8:442:13 | call to rand |
299+
| calls.rb:442:8:442:17 | ... > ... |
300+
| calls.rb:443:9:447:18 | call to m5 |
301+
| calls.rb:452:1:452:33 | call to m3 |
302+
| calls.rb:454:1:454:33 | call to m3 |
303+
| calls.rb:455:1:455:33 | call to m4 |
304+
| calls.rb:456:1:456:33 | call to m5 |
305+
| calls.rb:459:5:459:11 | call to [] |
306+
| calls.rb:459:5:463:7 | call to each |
307+
| calls.rb:465:5:469:15 | call to bar |
308+
| calls.rb:471:5:471:11 | call to [] |
309+
| calls.rb:471:5:475:7 | call to each |
310+
| calls.rb:472:9:474:11 | call to define_method |
311+
| calls.rb:478:1:478:31 | call to foo |
312+
| calls.rb:479:1:479:31 | call to bar |
313+
| calls.rb:480:1:480:33 | call to baz_0 |
314+
| calls.rb:481:1:481:33 | call to baz_1 |
315+
| calls.rb:482:1:482:33 | call to baz_2 |
316+
| calls.rb:486:9:486:46 | call to puts |
317+
| calls.rb:489:5:489:15 | call to extend |
318+
| calls.rb:495:5:495:32 | call to extend |
319+
| calls.rb:503:1:503:51 | call to extend |
320+
| calls.rb:508:1:508:13 | call to singleton |
321+
| calls.rb:509:1:509:32 | call to extend |
322+
| calls.rb:514:5:516:7 | call to protected |
323+
| calls.rb:515:9:515:42 | call to puts |
324+
| calls.rb:522:5:524:7 | call to protected |
325+
| calls.rb:534:1:534:24 | call to foo |
326+
| calls.rb:535:1:535:24 | call to bar |
327+
| calls.rb:545:1:545:27 | call to foo |
328+
| calls.rb:546:1:546:27 | call to bar |
329+
| calls.rb:549:1:549:7 | call to [] |
330+
| calls.rb:549:1:549:26 | call to each |
331+
| calls.rb:550:1:550:13 | call to [] |
332+
| calls.rb:550:1:550:39 | call to each |
329333
| hello.rb:20:16:20:26 | ... + ... |
330334
| hello.rb:20:16:20:34 | ... + ... |
331335
| hello.rb:20:16:20:40 | ... + ... |
@@ -351,8 +355,8 @@ privateMethod
351355
| calls.rb:278:1:286:3 | create |
352356
| calls.rb:343:1:359:3 | pattern_dispatch |
353357
| calls.rb:367:1:371:3 | add_singleton |
354-
| calls.rb:456:9:458:11 | foo |
355-
| calls.rb:462:9:464:11 | bar |
358+
| calls.rb:460:9:462:11 | foo |
359+
| calls.rb:466:9:468:11 | bar |
356360
| private.rb:2:11:3:5 | private1 |
357361
| private.rb:8:3:9:5 | private2 |
358362
| private.rb:14:3:15:5 | private3 |
@@ -417,16 +421,16 @@ publicMethod
417421
| calls.rb:383:9:385:11 | call_singleton1 |
418422
| calls.rb:388:5:390:7 | singleton2 |
419423
| calls.rb:392:5:394:7 | call_singleton2 |
420-
| calls.rb:404:9:406:11 | singleton1 |
421-
| calls.rb:409:5:411:7 | singleton2 |
422-
| calls.rb:419:9:421:11 | m1 |
423-
| calls.rb:424:5:436:7 | m2 |
424-
| calls.rb:427:9:433:11 | m3 |
425-
| calls.rb:430:13:432:15 | m4 |
426-
| calls.rb:440:13:442:15 | m5 |
427-
| calls.rb:481:5:483:7 | singleton |
428-
| calls.rb:522:5:527:7 | baz |
429-
| calls.rb:535:5:538:7 | baz |
424+
| calls.rb:406:9:408:11 | singleton1 |
425+
| calls.rb:411:5:413:7 | singleton2 |
426+
| calls.rb:423:9:425:11 | m1 |
427+
| calls.rb:428:5:440:7 | m2 |
428+
| calls.rb:431:9:437:11 | m3 |
429+
| calls.rb:434:13:436:15 | m4 |
430+
| calls.rb:444:13:446:15 | m5 |
431+
| calls.rb:485:5:487:7 | singleton |
432+
| calls.rb:526:5:531:7 | baz |
433+
| calls.rb:539:5:542:7 | baz |
430434
| hello.rb:2:5:4:7 | hello |
431435
| hello.rb:5:5:7:7 | world |
432436
| hello.rb:13:5:15:7 | message |
@@ -443,7 +447,7 @@ publicMethod
443447
| private.rb:66:3:67:5 | public |
444448
| private.rb:91:3:93:5 | call_m1 |
445449
protectedMethod
446-
| calls.rb:510:15:512:7 | foo |
447-
| calls.rb:518:15:520:7 | bar |
450+
| calls.rb:514:15:516:7 | foo |
451+
| calls.rb:522:15:524:7 | bar |
448452
| private.rb:32:3:33:5 | protected1 |
449453
| private.rb:35:3:36:5 | protected2 |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ def self.call_singleton2
396396
singleton2
397397
end
398398

399+
SingletonOverride1.singleton1
400+
SingletonOverride1.singleton2
399401
SingletonOverride1.call_singleton1
400402
SingletonOverride1.call_singleton2
401403

@@ -411,6 +413,8 @@ def self.singleton2
411413
end
412414
end
413415

416+
SingletonOverride2.singleton1
417+
SingletonOverride2.singleton2
414418
SingletonOverride2.call_singleton1
415419
SingletonOverride2.call_singleton2
416420

0 commit comments

Comments
 (0)