CFG: add nodes for block arguments

This commit is contained in:
Arthur Baars
2020-12-16 10:47:51 +01:00
parent d016e3cae0
commit eafec4331b
2 changed files with 14 additions and 1 deletions

View File

@@ -313,13 +313,14 @@ module Trees {
}
private class CallTree extends StandardPostOrderTree, Call {
// this.getBlock() is not included as it uses a different scope
final override AstNode getChildNode(int i) {
result = this.getReceiver() and i = 0
or
result = this.getMethod() and i = 1
or
result = this.getArguments() and i = 2
or
result = this.getBlock() and i = 3
}
}

View File

@@ -647,6 +647,9 @@ cfg.rb:
#-----| -> times
# 25| times
#-----| -> Block
# 25| Block
#-----| -> Call
# 25| x
@@ -680,6 +683,9 @@ cfg.rb:
#-----| -> new
# 29| new
#-----| -> Block
# 29| Block
#-----| -> Call
# 29| BlockParameter
@@ -1985,6 +1991,9 @@ cfg.rb:
#-----| -> exit top-level (normal)
# 189| run_block
#-----| -> Block
# 189| Block
#-----| -> Call
# 189| x
@@ -2627,6 +2636,9 @@ loops.rb:
#-----| -> Array
# 25| each
#-----| -> DoBlock
# 25| DoBlock
#-----| -> Call
# 25| x