Make BeginBlock CFG post-order

This commit is contained in:
Nick Rolfe
2021-05-06 16:45:27 +01:00
parent 2c7f1e0c11
commit 4e80b548c1
2 changed files with 7 additions and 5 deletions

View File

@@ -1108,7 +1108,8 @@ module Trees {
private class SimplePostOrderStmtSequenceTree extends StmtSequenceTree, PostOrderTree {
SimplePostOrderStmtSequenceTree() {
this instanceof StringInterpolationComponent or
this instanceof ParenthesizedExpr
this instanceof ParenthesizedExpr or
this instanceof BeginBlock
}
final override predicate first(AstNode first) { first(this.getStmt(0), first) }
@@ -1136,7 +1137,8 @@ module Trees {
not this instanceof EndBlock and
not this instanceof StringInterpolationComponent and
not this instanceof Block and
not this instanceof ParenthesizedExpr
not this instanceof ParenthesizedExpr and
not this instanceof BeginBlock
}
final override predicate propagatesAbnormal(AstNode child) { child = this.getAStmt() }

View File

@@ -491,7 +491,7 @@ case.rb:
cfg.rb:
# 1| enter cfg.rb
#-----| -> BEGIN { ... }
#-----| -> self
# 1| bar
#-----| -> alias ...
@@ -559,10 +559,10 @@ cfg.rb:
#-----| -> call to puts
# 15| BEGIN { ... }
#-----| -> self
#-----| -> bar
# 16| call to puts
#-----| -> bar
#-----| -> BEGIN { ... }
# 16| self
#-----| -> "hello"