Skip to content

Commit 586885f

Browse files
committed
Recognize blocks without parameters
1 parent 0f3a4a1 commit 586885f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

ql/src/codeql_ruby/ast/internal/Method.qll

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,21 @@ module Lambda {
4444
}
4545

4646
module Block {
47-
abstract class Range extends Callable::Range {
48-
Generated::BlockParameters params;
49-
50-
final override Parameter getParameter(int n) { result = params.getChild(n) }
51-
}
47+
abstract class Range extends Callable::Range { }
5248
}
5349

5450
module DoBlock {
5551
class Range extends Block::Range, @do_block {
5652
final override Generated::DoBlock generated;
5753

58-
Range() { params = generated.getParameters() }
54+
final override Parameter getParameter(int n) { result = generated.getParameters().getChild(n) }
5955
}
6056
}
6157

6258
module BraceBlock {
6359
class Range extends Block::Range, @block {
6460
final override Generated::Block generated;
6561

66-
Range() { params = generated.getParameters() }
62+
final override Parameter getParameter(int n) { result = generated.getParameters().getChild(n) }
6763
}
6864
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ callsWithNoReceiverArgumentsOrBlock
1616
| calls.rb:74:1:74:3 | call to foo | foo |
1717
| calls.rb:74:7:74:9 | call to bar | bar |
1818
| calls.rb:77:2:77:4 | call to foo | foo |
19-
| calls.rb:80:1:80:13 | call to foo | foo |
2019
| calls.rb:80:9:80:11 | call to bar | bar |
21-
| calls.rb:83:1:83:16 | call to foo | foo |
2220
| calls.rb:83:10:83:12 | call to bar | bar |
2321
| calls.rb:86:1:86:3 | call to foo | foo |
2422
| calls.rb:90:6:90:8 | call to foo | foo |
@@ -96,6 +94,8 @@ callsWithBlock
9694
| calls.rb:14:1:14:17 | call to foo | calls.rb:14:5:14:17 | { ... } |
9795
| calls.rb:17:1:19:3 | call to foo | calls.rb:17:5:19:3 | do ... end |
9896
| calls.rb:22:1:24:3 | call to bar | calls.rb:22:16:24:3 | do ... end |
97+
| calls.rb:80:1:80:13 | call to foo | calls.rb:80:7:80:13 | { ... } |
98+
| calls.rb:83:1:83:16 | call to foo | calls.rb:83:7:83:16 | do ... end |
9999
yieldCalls
100100
| calls.rb:28:3:28:7 | call to yield |
101101
| calls.rb:33:3:33:16 | call to yield |

0 commit comments

Comments
 (0)