mirror of
https://github.com/github/codeql.git
synced 2026-02-19 16:33:40 +01:00
Make SingletonClassDeclarationTree post-order
This commit is contained in:
@@ -1176,13 +1176,27 @@ module Trees {
|
||||
}
|
||||
}
|
||||
|
||||
private class SingletonClassTree extends BodyStmtPreOrderTree, SingletonClass {
|
||||
private class SingletonClassTree extends BodyStmtPostOrderTree, SingletonClass {
|
||||
final override predicate first(AstNode first) {
|
||||
this.firstInner(first)
|
||||
or
|
||||
not exists(this.getAChild(_)) and
|
||||
first = this
|
||||
}
|
||||
|
||||
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
|
||||
BodyStmtPostOrderTree.super.succ(pred, succ, c)
|
||||
or
|
||||
succ = this and
|
||||
this.lastInner(pred, c)
|
||||
}
|
||||
|
||||
/** Gets the `i`th child in the body of this block. */
|
||||
final override AstNode getBodyChild(int i, boolean rescuable) {
|
||||
(
|
||||
result = this.getValue() and i = 0 and rescuable = false
|
||||
or
|
||||
result = BodyStmtPreOrderTree.super.getBodyChild(i - 1, rescuable)
|
||||
result = BodyStmtPostOrderTree.super.getBodyChild(i - 1, rescuable)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1599,10 +1599,10 @@ cfg.rb:
|
||||
#-----| -> call to itself
|
||||
|
||||
# 141| Constant
|
||||
#-----| -> class << ...
|
||||
#-----| -> Silly
|
||||
|
||||
# 143| class << ...
|
||||
#-----| -> Silly
|
||||
#-----| -> silly
|
||||
|
||||
# 143| call to itself
|
||||
#-----| -> setter=
|
||||
@@ -1617,7 +1617,7 @@ cfg.rb:
|
||||
#-----| -> self
|
||||
|
||||
# 145| print
|
||||
#-----| -> silly
|
||||
#-----| -> class << ...
|
||||
|
||||
# 145| exit print
|
||||
|
||||
|
||||
Reference in New Issue
Block a user