3
3
private import codeql.ruby.AST
4
4
private import codeql.ruby.controlflow.BasicBlocks
5
5
private import SuccessorTypes
6
- private import internal.ControlFlowGraphImpl
6
+ private import internal.ControlFlowGraphImpl as CfgImpl
7
7
private import internal.Splitting
8
8
private import internal.Completion
9
9
@@ -15,12 +15,12 @@ private import internal.Completion
15
15
* Note that module declarations are not themselves CFG scopes, as they are part of
16
16
* the CFG of the enclosing top-level or callable.
17
17
*/
18
- class CfgScope extends Scope instanceof CfgScopeImpl {
18
+ class CfgScope extends Scope instanceof CfgImpl :: CfgScopeImpl {
19
19
/** Gets the CFG scope that this scope is nested under, if any. */
20
20
final CfgScope getOuterCfgScope ( ) {
21
21
exists ( AstNode parent |
22
22
parent = this .getParent ( ) and
23
- result = getCfgScope ( parent )
23
+ result = CfgImpl :: getCfgScope ( parent )
24
24
)
25
25
}
26
26
}
@@ -33,7 +33,7 @@ class CfgScope extends Scope instanceof CfgScopeImpl {
33
33
*
34
34
* Only nodes that can be reached from an entry point are included in the CFG.
35
35
*/
36
- class CfgNode extends TCfgNode {
36
+ class CfgNode extends CfgImpl :: TCfgNode {
37
37
/** Gets the name of the primary QL class for this node. */
38
38
string getAPrimaryQlClass ( ) { none ( ) }
39
39
@@ -53,13 +53,13 @@ class CfgNode extends TCfgNode {
53
53
final predicate isCondition ( ) { exists ( this .getASuccessor ( any ( ConditionalSuccessor bs ) ) ) }
54
54
55
55
/** Gets the scope of this node. */
56
- final CfgScope getScope ( ) { result = getNodeCfgScope ( this ) }
56
+ final CfgScope getScope ( ) { result = CfgImpl :: getNodeCfgScope ( this ) }
57
57
58
58
/** Gets the basic block that this control flow node belongs to. */
59
59
BasicBlock getBasicBlock ( ) { result .getANode ( ) = this }
60
60
61
61
/** Gets a successor node of a given type, if any. */
62
- final CfgNode getASuccessor ( SuccessorType t ) { result = getASuccessor ( this , t ) }
62
+ final CfgNode getASuccessor ( SuccessorType t ) { result = CfgImpl :: getASuccessor ( this , t ) }
63
63
64
64
/** Gets an immediate successor, if any. */
65
65
final CfgNode getASuccessor ( ) { result = this .getASuccessor ( _) }
@@ -78,15 +78,15 @@ class CfgNode extends TCfgNode {
78
78
}
79
79
80
80
/** The type of a control flow successor. */
81
- class SuccessorType extends TSuccessorType {
81
+ class SuccessorType extends CfgImpl :: TSuccessorType {
82
82
/** Gets a textual representation of successor type. */
83
83
string toString ( ) { none ( ) }
84
84
}
85
85
86
86
/** Provides different types of control flow successor types. */
87
87
module SuccessorTypes {
88
88
/** A normal control flow successor. */
89
- class NormalSuccessor extends SuccessorType , TSuccessorSuccessor {
89
+ class NormalSuccessor extends SuccessorType , CfgImpl :: TSuccessorSuccessor {
90
90
final override string toString ( ) { result = "successor" }
91
91
}
92
92
@@ -99,9 +99,9 @@ module SuccessorTypes {
99
99
boolean value ;
100
100
101
101
ConditionalSuccessor ( ) {
102
- this = TBooleanSuccessor ( value ) or
103
- this = TEmptinessSuccessor ( value ) or
104
- this = TMatchingSuccessor ( value )
102
+ this = CfgImpl :: TBooleanSuccessor ( value ) or
103
+ this = CfgImpl :: TEmptinessSuccessor ( value ) or
104
+ this = CfgImpl :: TMatchingSuccessor ( value )
105
105
}
106
106
107
107
/** Gets the Boolean value of this successor. */
@@ -125,7 +125,7 @@ module SuccessorTypes {
125
125
*
126
126
* `x >= 0` has both a `true` successor and a `false` successor.
127
127
*/
128
- class BooleanSuccessor extends ConditionalSuccessor , TBooleanSuccessor { }
128
+ class BooleanSuccessor extends ConditionalSuccessor , CfgImpl :: TBooleanSuccessor { }
129
129
130
130
/**
131
131
* An emptiness control flow successor.
@@ -158,7 +158,7 @@ module SuccessorTypes {
158
158
* \___/
159
159
* ```
160
160
*/
161
- class EmptinessSuccessor extends ConditionalSuccessor , TEmptinessSuccessor {
161
+ class EmptinessSuccessor extends ConditionalSuccessor , CfgImpl :: TEmptinessSuccessor {
162
162
override string toString ( ) { if value = true then result = "empty" else result = "non-empty" }
163
163
}
164
164
@@ -189,7 +189,7 @@ module SuccessorTypes {
189
189
* puts "one" puts "not one"
190
190
* ```
191
191
*/
192
- class MatchingSuccessor extends ConditionalSuccessor , TMatchingSuccessor {
192
+ class MatchingSuccessor extends ConditionalSuccessor , CfgImpl :: TMatchingSuccessor {
193
193
override string toString ( ) { if value = true then result = "match" else result = "no-match" }
194
194
}
195
195
@@ -207,7 +207,7 @@ module SuccessorTypes {
207
207
* The exit node of `sum` is a `return` successor of the `return x + y`
208
208
* statement.
209
209
*/
210
- class ReturnSuccessor extends SuccessorType , TReturnSuccessor {
210
+ class ReturnSuccessor extends SuccessorType , CfgImpl :: TReturnSuccessor {
211
211
final override string toString ( ) { result = "return" }
212
212
}
213
213
@@ -230,7 +230,7 @@ module SuccessorTypes {
230
230
*
231
231
* The node `puts "done"` is `break` successor of the node `break`.
232
232
*/
233
- class BreakSuccessor extends SuccessorType , TBreakSuccessor {
233
+ class BreakSuccessor extends SuccessorType , CfgImpl :: TBreakSuccessor {
234
234
final override string toString ( ) { result = "break" }
235
235
}
236
236
@@ -253,7 +253,7 @@ module SuccessorTypes {
253
253
*
254
254
* The node `x >= 0` is `next` successor of the node `next`.
255
255
*/
256
- class NextSuccessor extends SuccessorType , TNextSuccessor {
256
+ class NextSuccessor extends SuccessorType , CfgImpl :: TNextSuccessor {
257
257
final override string toString ( ) { result = "next" }
258
258
}
259
259
@@ -278,7 +278,7 @@ module SuccessorTypes {
278
278
*
279
279
* The node `x -= 1` is `redo` successor of the node `redo`.
280
280
*/
281
- class RedoSuccessor extends SuccessorType , TRedoSuccessor {
281
+ class RedoSuccessor extends SuccessorType , CfgImpl :: TRedoSuccessor {
282
282
final override string toString ( ) { result = "redo" }
283
283
}
284
284
@@ -302,7 +302,7 @@ module SuccessorTypes {
302
302
*
303
303
* The node `puts "Retry"` is `retry` successor of the node `retry`.
304
304
*/
305
- class RetrySuccessor extends SuccessorType , TRetrySuccessor {
305
+ class RetrySuccessor extends SuccessorType , CfgImpl :: TRetrySuccessor {
306
306
final override string toString ( ) { result = "retry" }
307
307
}
308
308
@@ -323,7 +323,7 @@ module SuccessorTypes {
323
323
* The exit node of `m` is an exceptional successor of the node
324
324
* `raise "x > 2"`.
325
325
*/
326
- class RaiseSuccessor extends SuccessorType , TRaiseSuccessor {
326
+ class RaiseSuccessor extends SuccessorType , CfgImpl :: TRaiseSuccessor {
327
327
final override string toString ( ) { result = "raise" }
328
328
}
329
329
@@ -344,7 +344,7 @@ module SuccessorTypes {
344
344
* The exit node of `m` is an exit successor of the node
345
345
* `exit 1`.
346
346
*/
347
- class ExitSuccessor extends SuccessorType , TExitSuccessor {
347
+ class ExitSuccessor extends SuccessorType , CfgImpl :: TExitSuccessor {
348
348
final override string toString ( ) { result = "exit" }
349
349
}
350
350
}
0 commit comments