@@ -316,7 +316,11 @@ abstract class LoopingExprTree extends PostOrderTree {
316316
317317 abstract Label getLabel ( ) ;
318318
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 ( ) ;
320324
321325 /** Holds if this loop captures the `c` completion. */
322326 private predicate capturesLoopJumpCompletion ( LoopJumpCompletion c ) {
@@ -339,7 +343,7 @@ abstract class LoopingExprTree extends PostOrderTree {
339343 or
340344 c .( LoopJumpCompletion ) .isContinue ( ) and this .capturesLoopJumpCompletion ( c )
341345 ) and
342- this .entry ( succ )
346+ first ( this .getLoopContinue ( ) , succ )
343347 }
344348
345349 override predicate last ( AstNode last , Completion c ) {
@@ -357,7 +361,7 @@ class LoopExprTree extends LoopingExprTree instanceof LoopExpr {
357361
358362 override Label getLabel ( ) { result = LoopExpr .super .getLabel ( ) }
359363
360- override predicate entry ( AstNode node ) { this .first ( node ) }
364+ override AstNode getLoopContinue ( ) { result = this .getLoopBody ( ) }
361365
362366 override predicate first ( AstNode node ) { first ( this .getLoopBody ( ) , node ) }
363367}
@@ -367,7 +371,7 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr {
367371
368372 override Label getLabel ( ) { result = WhileExpr .super .getLabel ( ) }
369373
370- override predicate entry ( AstNode node ) { this . first ( node ) }
374+ override AstNode getLoopContinue ( ) { result = super . getCondition ( ) }
371375
372376 override predicate propagatesAbnormal ( AstNode child ) { child = super .getCondition ( ) }
373377
@@ -397,7 +401,7 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {
397401
398402 override Label getLabel ( ) { result = ForExpr .super .getLabel ( ) }
399403
400- override predicate entry ( AstNode n ) { first ( super .getPat ( ) , n ) }
404+ override AstNode getLoopContinue ( ) { result = super .getPat ( ) }
401405
402406 override predicate propagatesAbnormal ( AstNode child ) { child = super .getIterable ( ) }
403407
0 commit comments