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