File tree Expand file tree Collapse file tree 2 files changed +15
-17
lines changed
lib/codeql/ruby/controlflow/internal Expand file tree Collapse file tree 2 files changed +15
-17
lines changed Original file line number Diff line number Diff line change 1
1
import codeql.ruby.controlflow.internal.ControlFlowGraphImplShared:: Consistency
2
2
import codeql.ruby.AST
3
+ import codeql.ruby.controlflow.internal.Completion
3
4
import codeql.ruby.controlflow.internal.ControlFlowGraphImpl
4
5
5
6
/**
6
7
* All `Expr` nodes are `PostOrderTree`s
7
8
*/
8
- query predicate nonPostOrderExprTypes ( string cls ) {
9
- exists ( Expr e |
10
- e instanceof ControlFlowTree and
11
- not exists ( e .getDesugared ( ) ) and
12
- cls = e .getAPrimaryQlClass ( ) and
13
- not e instanceof PostOrderTree and
14
- not e instanceof LeafTree
15
- )
16
- or
17
- exists ( Expr e |
18
- e instanceof ControlFlowTree and
19
- e = any ( AstNode x ) .getDesugared ( ) and
20
- cls = e .getAPrimaryQlClass ( ) and
21
- not e instanceof PostOrderTree and
22
- not e instanceof LeafTree
9
+ query predicate nonPostOrderExpr ( Expr e , string cls ) {
10
+ cls = e .getPrimaryQlClasses ( ) and
11
+ not exists ( e .getDesugared ( ) ) and
12
+ not e instanceof BeginExpr and
13
+ not e instanceof Namespace and
14
+ not e instanceof Toplevel and
15
+ exists ( AstNode last , Completion c |
16
+ last ( e , last , c ) and
17
+ last != e and
18
+ c instanceof NormalCompletion
23
19
)
24
20
}
Original file line number Diff line number Diff line change @@ -399,6 +399,7 @@ module Trees {
399
399
)
400
400
or
401
401
succ = this and
402
+ c instanceof NormalCompletion and
402
403
(
403
404
last ( this .getValue ( ) , pred , c ) and not exists ( this .getABranch ( ) )
404
405
or
@@ -442,12 +443,12 @@ module Trees {
442
443
)
443
444
or
444
445
succ = this and
446
+ c instanceof NormalCompletion and
445
447
(
446
448
last ( this .getABranch ( ) , pred , c ) and
447
449
not c .( MatchingCompletion ) .getValue ( ) = false
448
450
or
449
- last ( this .getElseBranch ( ) , pred , c ) and
450
- c instanceof NormalCompletion
451
+ last ( this .getElseBranch ( ) , pred , c )
451
452
)
452
453
}
453
454
}
@@ -1166,6 +1167,7 @@ module Trees {
1166
1167
)
1167
1168
or
1168
1169
last ( this .getHandler ( ) , pred , c ) and
1170
+ c instanceof NormalCompletion and
1169
1171
succ = this
1170
1172
}
1171
1173
}
You can’t perform that action at this time.
0 commit comments