File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
lib/codeql/ruby/dataflow/internal
test/library-tests/modules Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -314,15 +314,20 @@ private module Cached {
314
314
exists ( Module tp |
315
315
instanceMethodCall ( call , tp , method ) and
316
316
result = lookupMethod ( tp , method ) and
317
- if result .( Method ) .isPrivate ( )
318
- then
319
- call .getReceiver ( ) .getExpr ( ) instanceof SelfVariableAccess and
320
- // For now, we restrict the scope of top-level declarations to their file.
321
- // This may remove some plausible targets, but also removes a lot of
322
- // implausible targets
323
- if result .getEnclosingModule ( ) instanceof Toplevel
324
- then result .getFile ( ) = call .getFile ( )
317
+ (
318
+ if result .( Method ) .isPrivate ( )
319
+ then
320
+ call .getReceiver ( ) .getExpr ( ) instanceof SelfVariableAccess and
321
+ // For now, we restrict the scope of top-level declarations to their file.
322
+ // This may remove some plausible targets, but also removes a lot of
323
+ // implausible targets
324
+ if result .getEnclosingModule ( ) instanceof Toplevel
325
+ then result .getFile ( ) = call .getFile ( )
326
+ else any ( )
325
327
else any ( )
328
+ ) and
329
+ if result .( Method ) .isProtected ( )
330
+ then result = lookupMethod ( call .getExpr ( ) .getEnclosingModule ( ) .getModule ( ) , method )
326
331
else any ( )
327
332
)
328
333
or
Original file line number Diff line number Diff line change @@ -188,7 +188,6 @@ getTarget
188
188
| calls.rb:494:9:494:28 | call to new | calls.rb:114:5:114:16 | new |
189
189
| calls.rb:494:9:494:32 | call to foo | calls.rb:488:15:490:7 | foo |
190
190
| calls.rb:498:1:498:20 | call to new | calls.rb:114:5:114:16 | new |
191
- | calls.rb:498:1:498:24 | call to foo | calls.rb:488:15:490:7 | foo |
192
191
| calls.rb:499:1:499:20 | call to new | calls.rb:114:5:114:16 | new |
193
192
| calls.rb:499:1:499:24 | call to bar | calls.rb:492:5:495:7 | bar |
194
193
| hello.rb:12:5:12:24 | call to include | calls.rb:107:5:107:20 | include |
@@ -294,6 +293,7 @@ unresolvedCall
294
293
| calls.rb:482:5:482:15 | call to extend |
295
294
| calls.rb:485:1:485:31 | call to singleton |
296
295
| calls.rb:488:5:490:7 | call to protected |
296
+ | calls.rb:498:1:498:24 | call to foo |
297
297
| hello.rb:20:16:20:26 | ... + ... |
298
298
| hello.rb:20:16:20:34 | ... + ... |
299
299
| hello.rb:20:16:20:40 | ... + ... |
You can’t perform that action at this time.
0 commit comments