@@ -15,11 +15,18 @@ private newtype TCompletion =
15
15
TBooleanCompletion ( boolean b ) { b in [ false , true ] } or
16
16
TReturnCompletion ( ) or
17
17
TBreakCompletion ( ) or
18
+ TContinueCompletion ( ) or
18
19
TRaiseCompletion ( ) or
19
20
TExitCompletion ( )
20
21
21
22
pragma [ noinline]
22
- private predicate completionIsValidForStmt ( Ast n , Completion c ) { none ( ) }
23
+ private predicate completionIsValidForStmt ( Ast n , Completion c ) {
24
+ n instanceof BreakStmt and
25
+ c instanceof BreakCompletion
26
+ or
27
+ n instanceof ContinueStmt and
28
+ c instanceof ContinueCompletion
29
+ }
23
30
24
31
/** A completion of a statement or an expression. */
25
32
abstract class Completion extends TCompletion {
@@ -49,19 +56,10 @@ abstract class Completion extends TCompletion {
49
56
* Holds if this completion will continue a loop when it is the completion
50
57
* of a loop body.
51
58
*/
52
- predicate continuesLoop ( ) { this instanceof NormalCompletion }
53
-
54
- /**
55
- * Gets the inner completion. This is either the inner completion,
56
- * when the completion is nested, or the completion itself.
57
- */
58
- Completion getInnerCompletion ( ) { result = this }
59
-
60
- /**
61
- * Gets the outer completion. This is either the outer completion,
62
- * when the completion is nested, or the completion itself.
63
- */
64
- Completion getOuterCompletion ( ) { result = this }
59
+ predicate continuesLoop ( ) {
60
+ this instanceof NormalCompletion or
61
+ this instanceof ContinueCompletion
62
+ }
65
63
66
64
/** Gets a successor type that matches this completion. */
67
65
abstract SuccessorType getAMatchingSuccessorType ( ) ;
@@ -159,6 +157,16 @@ class BreakCompletion extends Completion, TBreakCompletion {
159
157
override string toString ( ) { result = "break" }
160
158
}
161
159
160
+ /**
161
+ * A completion that represents evaluation of a statement or an
162
+ * expression resulting in a continuation of a loop.
163
+ */
164
+ class ContinueCompletion extends Completion , TContinueCompletion {
165
+ override ContinueSuccessor getAMatchingSuccessorType ( ) { any ( ) }
166
+
167
+ override string toString ( ) { result = "continue" }
168
+ }
169
+
162
170
/**
163
171
* A completion that represents evaluation of a statement or an
164
172
* expression resulting in a thrown exception.
0 commit comments