@@ -200,8 +200,7 @@ class TypeReprTree extends LeafTree instanceof TypeRepr { }
200200/**
201201 * Provides `ControlFlowTree`s for expressions.
202202 *
203- * Since expressions construct values, they are modeled in post-order, except for
204- * `LetExpr`s.
203+ * Since expressions construct values, they are modeled in post-order.
205204 */
206205module ExprTrees {
207206 class ArrayExprTree extends StandardPostOrderTree , ArrayExpr {
@@ -341,21 +340,15 @@ module ExprTrees {
341340 child = [ super .getCondition ( ) , super .getABranch ( ) ]
342341 }
343342
344- private ConditionalCompletion conditionCompletion ( Completion c ) {
345- if super .getCondition ( ) instanceof LetExpr
346- then result = c .( MatchCompletion )
347- else result = c .( BooleanCompletion )
348- }
349-
350343 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
351344 // Edges from the condition to the branches
352345 last ( super .getCondition ( ) , pred , c ) and
353346 (
354- first ( super .getThen ( ) , succ ) and this . conditionCompletion ( c ) .succeeded ( )
347+ first ( super .getThen ( ) , succ ) and c . ( ConditionalCompletion ) .succeeded ( )
355348 or
356- first ( super .getElse ( ) , succ ) and this . conditionCompletion ( c ) .failed ( )
349+ first ( super .getElse ( ) , succ ) and c . ( ConditionalCompletion ) .failed ( )
357350 or
358- not super .hasElse ( ) and succ = this and this . conditionCompletion ( c ) .failed ( )
351+ not super .hasElse ( ) and succ = this and c . ( ConditionalCompletion ) .failed ( )
359352 )
360353 or
361354 // An edge from the then branch to the last node
@@ -401,10 +394,7 @@ module ExprTrees {
401394 }
402395 }
403396
404- // `LetExpr` is a pre-order tree such that the pattern itself ends up
405- // dominating successors in the graph in the same way that patterns do in
406- // `match` expressions.
407- class LetExprTree extends StandardPreOrderTree , LetExpr {
397+ class LetExprTree extends StandardPostOrderTree , LetExpr {
408398 override AstNode getChildNode ( int i ) {
409399 i = 0 and
410400 result = this .getScrutinee ( )
@@ -456,21 +446,15 @@ module ExprTrees {
456446
457447 override predicate first ( AstNode node ) { first ( super .getCondition ( ) , node ) }
458448
459- private ConditionalCompletion conditionCompletion ( Completion c ) {
460- if super .getCondition ( ) instanceof LetExpr
461- then result = c .( MatchCompletion )
462- else result = c .( BooleanCompletion )
463- }
464-
465449 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
466450 super .succ ( pred , succ , c )
467451 or
468452 last ( super .getCondition ( ) , pred , c ) and
469- this . conditionCompletion ( c ) .succeeded ( ) and
453+ c . ( ConditionalCompletion ) .succeeded ( ) and
470454 first ( this .getLoopBody ( ) , succ )
471455 or
472456 last ( super .getCondition ( ) , pred , c ) and
473- this . conditionCompletion ( c ) .failed ( ) and
457+ c . ( ConditionalCompletion ) .failed ( ) and
474458 succ = this
475459 }
476460 }
0 commit comments