Address comments

This commit is contained in:
Arthur Baars
2021-12-16 16:19:00 +01:00
parent 83a8a60676
commit 560413f94a
2 changed files with 15 additions and 17 deletions

View File

@@ -1,24 +1,20 @@
import codeql.ruby.controlflow.internal.ControlFlowGraphImplShared::Consistency
import codeql.ruby.AST
import codeql.ruby.controlflow.internal.Completion
import codeql.ruby.controlflow.internal.ControlFlowGraphImpl
/**
* All `Expr` nodes are `PostOrderTree`s
*/
query predicate nonPostOrderExprTypes(string cls) {
exists(Expr e |
e instanceof ControlFlowTree and
not exists(e.getDesugared()) and
cls = e.getAPrimaryQlClass() and
not e instanceof PostOrderTree and
not e instanceof LeafTree
)
or
exists(Expr e |
e instanceof ControlFlowTree and
e = any(AstNode x).getDesugared() and
cls = e.getAPrimaryQlClass() and
not e instanceof PostOrderTree and
not e instanceof LeafTree
query predicate nonPostOrderExpr(Expr e, string cls) {
cls = e.getPrimaryQlClasses() and
not exists(e.getDesugared()) and
not e instanceof BeginExpr and
not e instanceof Namespace and
not e instanceof Toplevel and
exists(AstNode last, Completion c |
last(e, last, c) and
last != e and
c instanceof NormalCompletion
)
}

View File

@@ -399,6 +399,7 @@ module Trees {
)
or
succ = this and
c instanceof NormalCompletion and
(
last(this.getValue(), pred, c) and not exists(this.getABranch())
or
@@ -442,12 +443,12 @@ module Trees {
)
or
succ = this and
c instanceof NormalCompletion and
(
last(this.getABranch(), pred, c) and
not c.(MatchingCompletion).getValue() = false
or
last(this.getElseBranch(), pred, c) and
c instanceof NormalCompletion
last(this.getElseBranch(), pred, c)
)
}
}
@@ -1166,6 +1167,7 @@ module Trees {
)
or
last(this.getHandler(), pred, c) and
c instanceof NormalCompletion and
succ = this
}
}