@@ -734,15 +734,12 @@ module Trees {
734
734
override ControlFlowTree getChildElement ( int i ) { result = this .getVariableAccess ( ) and i = 0 }
735
735
}
736
736
737
- private class InClauseTree extends PostOrderTree , InClause {
737
+ private class InClauseTree extends PreOrderTree , InClause {
738
738
final override predicate propagatesAbnormal ( AstNode child ) {
739
739
child = this .getPattern ( ) or
740
- child = this .getCondition ( ) or
741
- child = this .getBody ( )
740
+ child = this .getCondition ( )
742
741
}
743
742
744
- final override predicate first ( AstNode first ) { first ( this .getPattern ( ) , first ) }
745
-
746
743
private predicate lastCondition ( AstNode last , BooleanCompletion c , boolean flag ) {
747
744
last ( this .getCondition ( ) , last , c ) and
748
745
(
@@ -753,44 +750,51 @@ module Trees {
753
750
}
754
751
755
752
final override predicate last ( AstNode last , Completion c ) {
756
- super .last ( last , c )
757
- or
758
753
last ( this .getPattern ( ) , last , c ) and
759
754
c .( MatchingCompletion ) .getValue ( ) = false
760
755
or
761
- exists ( BooleanCompletion bc , boolean flag |
762
- bc .getValue ( ) = flag .booleanNot ( ) and
756
+ exists ( BooleanCompletion bc , boolean flag , MatchingCompletion mc |
763
757
lastCondition ( last , bc , flag ) and
764
758
c =
765
759
any ( NestedMatchingCompletion nmc |
766
- nmc .getInnerCompletion ( ) = bc and nmc .getOuterCompletion ( ) . getValue ( ) = false
760
+ nmc .getInnerCompletion ( ) = bc and nmc .getOuterCompletion ( ) = mc
767
761
)
762
+ |
763
+ mc .getValue ( ) = false and
764
+ bc .getValue ( ) = flag .booleanNot ( )
765
+ or
766
+ not exists ( this .getBody ( ) ) and
767
+ mc .getValue ( ) = true and
768
+ bc .getValue ( ) = flag
768
769
)
770
+ or
771
+ last ( this .getBody ( ) , last , c )
772
+ or
773
+ not exists ( this .getBody ( ) ) and
774
+ not exists ( this .getCondition ( ) ) and
775
+ last ( this .getPattern ( ) , last , c )
769
776
}
770
777
771
778
final override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
772
- last ( this .getPattern ( ) , pred , c ) and
773
- not c .( MatchingCompletion ) .getValue ( ) = false and
774
- (
775
- first ( this .getCondition ( ) , succ )
776
- or
777
- not exists ( this .getCondition ( ) ) and first ( this .getBody ( ) , succ )
779
+ pred = this and
780
+ first ( this .getPattern ( ) , succ ) and
781
+ c instanceof SimpleCompletion
782
+ or
783
+ exists ( Expr next |
784
+ last ( this .getPattern ( ) , pred , c ) and
785
+ c .( MatchingCompletion ) .getValue ( ) = true and
786
+ first ( next , succ )
787
+ |
788
+ next = this .getCondition ( )
778
789
or
779
- not exists ( this .getCondition ( ) ) and not exists ( this .getBody ( ) ) and succ = this
790
+ not exists ( this .getCondition ( ) ) and next = this .getBody ( )
780
791
)
781
792
or
782
793
exists ( boolean flag |
783
794
lastCondition ( pred , c , flag ) and
784
- c .( BooleanCompletion ) .getValue ( ) = flag
785
- |
795
+ c .( BooleanCompletion ) .getValue ( ) = flag and
786
796
first ( this .getBody ( ) , succ )
787
- or
788
- not exists ( this .getBody ( ) ) and succ = this
789
797
)
790
- or
791
- last ( this .getBody ( ) , pred , c ) and
792
- succ = this and
793
- c instanceof NormalCompletion
794
798
}
795
799
}
796
800
0 commit comments