@@ -41,61 +41,59 @@ private import codeql.ruby.controlflow.ControlFlowGraph
41
41
private import Completion
42
42
import ControlFlowGraphImplShared
43
43
44
- module CfgScope {
45
- abstract class Range_ extends AstNode {
46
- abstract predicate entry ( AstNode first ) ;
44
+ abstract class CfgScopeImpl extends AstNode {
45
+ abstract predicate entry ( AstNode first ) ;
47
46
48
- abstract predicate exit ( AstNode last , Completion c ) ;
49
- }
47
+ abstract predicate exit ( AstNode last , Completion c ) ;
48
+ }
50
49
51
- private class ToplevelScope extends Range_ , Toplevel {
52
- final override predicate entry ( AstNode first ) { first ( this , first ) }
50
+ private class ToplevelScope extends CfgScopeImpl , Toplevel {
51
+ final override predicate entry ( AstNode first ) { first ( this , first ) }
53
52
54
- final override predicate exit ( AstNode last , Completion c ) { last ( this , last , c ) }
55
- }
53
+ final override predicate exit ( AstNode last , Completion c ) { last ( this , last , c ) }
54
+ }
56
55
57
- private class EndBlockScope extends Range_ , EndBlock {
58
- final override predicate entry ( AstNode first ) {
59
- first ( this .( Trees:: EndBlockTree ) .getBodyChild ( 0 , _) , first )
60
- }
56
+ private class EndBlockScope extends CfgScopeImpl , EndBlock {
57
+ final override predicate entry ( AstNode first ) {
58
+ first ( this .( Trees:: EndBlockTree ) .getBodyChild ( 0 , _) , first )
59
+ }
61
60
62
- final override predicate exit ( AstNode last , Completion c ) {
63
- last ( this .( Trees:: EndBlockTree ) .getLastBodyChild ( ) , last , c )
64
- or
65
- last ( this .( Trees:: EndBlockTree ) .getBodyChild ( _, _) , last , c ) and
66
- not c instanceof NormalCompletion
67
- }
61
+ final override predicate exit ( AstNode last , Completion c ) {
62
+ last ( this .( Trees:: EndBlockTree ) .getLastBodyChild ( ) , last , c )
63
+ or
64
+ last ( this .( Trees:: EndBlockTree ) .getBodyChild ( _, _) , last , c ) and
65
+ not c instanceof NormalCompletion
68
66
}
67
+ }
69
68
70
- private class BodyStmtCallableScope extends Range_ , ASTInternal:: TBodyStmt , Callable {
71
- final override predicate entry ( AstNode first ) { this .( Trees:: BodyStmtTree ) .firstInner ( first ) }
69
+ private class BodyStmtCallableScope extends CfgScopeImpl , ASTInternal:: TBodyStmt , Callable {
70
+ final override predicate entry ( AstNode first ) { this .( Trees:: BodyStmtTree ) .firstInner ( first ) }
72
71
73
- final override predicate exit ( AstNode last , Completion c ) {
74
- this .( Trees:: BodyStmtTree ) .lastInner ( last , c )
75
- }
72
+ final override predicate exit ( AstNode last , Completion c ) {
73
+ this .( Trees:: BodyStmtTree ) .lastInner ( last , c )
76
74
}
75
+ }
77
76
78
- private class BraceBlockScope extends Range_ , BraceBlock {
79
- final override predicate entry ( AstNode first ) {
80
- first ( this .( Trees:: BraceBlockTree ) .getBodyChild ( 0 , _) , first )
81
- }
77
+ private class BraceBlockScope extends CfgScopeImpl , BraceBlock {
78
+ final override predicate entry ( AstNode first ) {
79
+ first ( this .( Trees:: BraceBlockTree ) .getBodyChild ( 0 , _) , first )
80
+ }
82
81
83
- final override predicate exit ( AstNode last , Completion c ) {
84
- last ( this .( Trees:: BraceBlockTree ) .getLastBodyChild ( ) , last , c )
85
- or
86
- last ( this .( Trees:: BraceBlockTree ) .getBodyChild ( _, _) , last , c ) and
87
- not c instanceof NormalCompletion
88
- }
82
+ final override predicate exit ( AstNode last , Completion c ) {
83
+ last ( this .( Trees:: BraceBlockTree ) .getLastBodyChild ( ) , last , c )
84
+ or
85
+ last ( this .( Trees:: BraceBlockTree ) .getBodyChild ( _, _) , last , c ) and
86
+ not c instanceof NormalCompletion
89
87
}
90
88
}
91
89
92
90
/** Holds if `first` is first executed when entering `scope`. */
93
91
pragma [ nomagic]
94
- predicate succEntry ( CfgScope :: Range_ scope , AstNode first ) { scope .entry ( first ) }
92
+ predicate succEntry ( CfgScopeImpl scope , AstNode first ) { scope .entry ( first ) }
95
93
96
94
/** Holds if `last` with completion `c` can exit `scope`. */
97
95
pragma [ nomagic]
98
- predicate succExit ( CfgScope :: Range_ scope , AstNode last , Completion c ) { scope .exit ( last , c ) }
96
+ predicate succExit ( CfgScopeImpl scope , AstNode last , Completion c ) { scope .exit ( last , c ) }
99
97
100
98
/** Defines the CFG by dispatch on the various AST types. */
101
99
module Trees {
@@ -1431,7 +1429,7 @@ module Trees {
1431
1429
1432
1430
private Scope parent ( Scope n ) {
1433
1431
result = n .getOuterScope ( ) and
1434
- not n instanceof CfgScope :: Range_
1432
+ not n instanceof CfgScopeImpl
1435
1433
}
1436
1434
1437
1435
cached
0 commit comments