@@ -732,12 +732,15 @@ module Trees {
732732 override ControlFlowTree getChildElement ( int i ) { result = this .getVariableAccess ( ) and i = 0 }
733733 }
734734
735- private class InClauseTree extends PreOrderTree , InClause {
735+ private class InClauseTree extends PostOrderTree , InClause {
736736 final override predicate propagatesAbnormal ( AstNode child ) {
737737 child = this .getPattern ( ) or
738- child = this .getCondition ( )
738+ child = this .getCondition ( ) or
739+ child = this .getBody ( )
739740 }
740741
742+ final override predicate first ( AstNode first ) { first ( this .getPattern ( ) , first ) }
743+
741744 private predicate lastCondition ( AstNode last , BooleanCompletion c , boolean flag ) {
742745 last ( this .getCondition ( ) , last , c ) and
743746 (
@@ -748,51 +751,44 @@ module Trees {
748751 }
749752
750753 final override predicate last ( AstNode last , Completion c ) {
754+ super .last ( last , c )
755+ or
751756 last ( this .getPattern ( ) , last , c ) and
752757 c .( MatchingCompletion ) .getValue ( ) = false
753758 or
754- exists ( BooleanCompletion bc , boolean flag , MatchingCompletion mc |
759+ exists ( BooleanCompletion bc , boolean flag |
760+ bc .getValue ( ) = flag .booleanNot ( ) and
755761 lastCondition ( last , bc , flag ) and
756762 c =
757763 any ( NestedMatchingCompletion nmc |
758- nmc .getInnerCompletion ( ) = bc and nmc .getOuterCompletion ( ) = mc
764+ nmc .getInnerCompletion ( ) = bc and nmc .getOuterCompletion ( ) . getValue ( ) = false
759765 )
760- |
761- mc .getValue ( ) = false and
762- bc .getValue ( ) = flag .booleanNot ( )
763- or
764- not exists ( this .getBody ( ) ) and
765- mc .getValue ( ) = true and
766- bc .getValue ( ) = flag
767766 )
768- or
769- last ( this .getBody ( ) , last , c )
770- or
771- not exists ( this .getBody ( ) ) and
772- not exists ( this .getCondition ( ) ) and
773- last ( this .getPattern ( ) , last , c )
774767 }
775768
776769 final override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
777- pred = this and
778- first ( this .getPattern ( ) , succ ) and
779- c instanceof SimpleCompletion
780- or
781- exists ( Expr next |
782- last ( this .getPattern ( ) , pred , c ) and
783- c .( MatchingCompletion ) .getValue ( ) = true and
784- first ( next , succ )
785- |
786- next = this .getCondition ( )
770+ last ( this .getPattern ( ) , pred , c ) and
771+ not c .( MatchingCompletion ) .getValue ( ) = false and
772+ (
773+ first ( this .getCondition ( ) , succ )
774+ or
775+ not exists ( this .getCondition ( ) ) and first ( this .getBody ( ) , succ )
787776 or
788- not exists ( this .getCondition ( ) ) and next = this .getBody ( )
777+ not exists ( this .getCondition ( ) ) and not exists ( this .getBody ( ) ) and succ = this
789778 )
790779 or
791780 exists ( boolean flag |
792781 lastCondition ( pred , c , flag ) and
793- c .( BooleanCompletion ) .getValue ( ) = flag and
782+ c .( BooleanCompletion ) .getValue ( ) = flag
783+ |
794784 first ( this .getBody ( ) , succ )
785+ or
786+ not exists ( this .getBody ( ) ) and succ = this
795787 )
788+ or
789+ last ( this .getBody ( ) , pred , c ) and
790+ succ = this and
791+ c instanceof NormalCompletion
796792 }
797793 }
798794
0 commit comments