Merge pull request #102 from github/hvitved/blocks-no-params

Recognize blocks without parameters
This commit is contained in:
Nick Rolfe
2021-01-22 15:44:14 +00:00
committed by GitHub
2 changed files with 5 additions and 9 deletions

View File

@@ -44,18 +44,14 @@ module Lambda {
}
module Block {
abstract class Range extends Callable::Range {
Generated::BlockParameters params;
final override Parameter getParameter(int n) { result = params.getChild(n) }
}
abstract class Range extends Callable::Range { }
}
module DoBlock {
class Range extends Block::Range, @do_block {
final override Generated::DoBlock generated;
Range() { params = generated.getParameters() }
final override Parameter getParameter(int n) { result = generated.getParameters().getChild(n) }
}
}
@@ -63,6 +59,6 @@ module BraceBlock {
class Range extends Block::Range, @block {
final override Generated::Block generated;
Range() { params = generated.getParameters() }
final override Parameter getParameter(int n) { result = generated.getParameters().getChild(n) }
}
}

View File

@@ -16,9 +16,7 @@ callsWithNoReceiverArgumentsOrBlock
| calls.rb:74:1:74:3 | call to foo | foo |
| calls.rb:74:7:74:9 | call to bar | bar |
| calls.rb:77:2:77:4 | call to foo | foo |
| calls.rb:80:1:80:13 | call to foo | foo |
| calls.rb:80:9:80:11 | call to bar | bar |
| calls.rb:83:1:83:16 | call to foo | foo |
| calls.rb:83:10:83:12 | call to bar | bar |
| calls.rb:86:1:86:3 | call to foo | foo |
| calls.rb:90:6:90:8 | call to foo | foo |
@@ -96,6 +94,8 @@ callsWithBlock
| calls.rb:14:1:14:17 | call to foo | calls.rb:14:5:14:17 | { ... } |
| calls.rb:17:1:19:3 | call to foo | calls.rb:17:5:19:3 | do ... end |
| calls.rb:22:1:24:3 | call to bar | calls.rb:22:16:24:3 | do ... end |
| calls.rb:80:1:80:13 | call to foo | calls.rb:80:7:80:13 | { ... } |
| calls.rb:83:1:83:16 | call to foo | calls.rb:83:7:83:16 | do ... end |
yieldCalls
| calls.rb:28:3:28:7 | call to yield |
| calls.rb:33:3:33:16 | call to yield |