@@ -316,7 +316,11 @@ abstract class LoopingExprTree extends PostOrderTree {
316
316
317
317
abstract Label getLabel ( ) ;
318
318
319
- abstract predicate entry ( AstNode node ) ;
319
+ /**
320
+ * Gets the node to execute when continuing the loop; either after
321
+ * executing the last node in the body or after an explicit `continue`.
322
+ */
323
+ abstract AstNode getLoopContinue ( ) ;
320
324
321
325
/** Holds if this loop captures the `c` completion. */
322
326
private predicate capturesLoopJumpCompletion ( LoopJumpCompletion c ) {
@@ -339,7 +343,7 @@ abstract class LoopingExprTree extends PostOrderTree {
339
343
or
340
344
c .( LoopJumpCompletion ) .isContinue ( ) and this .capturesLoopJumpCompletion ( c )
341
345
) and
342
- this .entry ( succ )
346
+ first ( this .getLoopContinue ( ) , succ )
343
347
}
344
348
345
349
override predicate last ( AstNode last , Completion c ) {
@@ -357,7 +361,7 @@ class LoopExprTree extends LoopingExprTree instanceof LoopExpr {
357
361
358
362
override Label getLabel ( ) { result = LoopExpr .super .getLabel ( ) }
359
363
360
- override predicate entry ( AstNode node ) { this .first ( node ) }
364
+ override AstNode getLoopContinue ( ) { result = this .getLoopBody ( ) }
361
365
362
366
override predicate first ( AstNode node ) { first ( this .getLoopBody ( ) , node ) }
363
367
}
@@ -367,7 +371,7 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr {
367
371
368
372
override Label getLabel ( ) { result = WhileExpr .super .getLabel ( ) }
369
373
370
- override predicate entry ( AstNode node ) { this . first ( node ) }
374
+ override AstNode getLoopContinue ( ) { result = super . getCondition ( ) }
371
375
372
376
override predicate propagatesAbnormal ( AstNode child ) { child = super .getCondition ( ) }
373
377
@@ -397,7 +401,7 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {
397
401
398
402
override Label getLabel ( ) { result = ForExpr .super .getLabel ( ) }
399
403
400
- override predicate entry ( AstNode n ) { first ( super .getPat ( ) , n ) }
404
+ override AstNode getLoopContinue ( ) { result = super .getPat ( ) }
401
405
402
406
override predicate propagatesAbnormal ( AstNode child ) { child = super .getIterable ( ) }
403
407
0 commit comments