@@ -399,13 +399,20 @@ module Make<LocationSig Location, InputSig<Location> Input> {
399
399
}
400
400
}
401
401
402
+ private predicate isFullyConstructedSplits ( Splits splits ) { exists ( TAstNode ( _, _, splits ) ) }
403
+
402
404
/**
403
405
* A set of control flow node splits. The set is represented by a list of splits,
404
406
* ordered by ascending rank.
405
407
*/
406
408
class Splits extends TSplits {
407
409
/** Gets a textual representation of this set of splits. */
408
- string toString ( ) { result = splitsToString ( this ) }
410
+ string toString ( ) {
411
+ result = splitsToString ( this )
412
+ or
413
+ not isFullyConstructedSplits ( this ) and
414
+ result = "<partial split set>"
415
+ }
409
416
410
417
/** Gets a split belonging to this set of splits. */
411
418
SplitImpl getASplit ( ) {
@@ -857,23 +864,27 @@ module Make<LocationSig Location, InputSig<Location> Input> {
857
864
succEntrySplitsCons ( _, _, head , tail , _)
858
865
}
859
866
867
+ private string getSplitStringAt ( Splits split , int index ) {
868
+ exists ( SplitImpl head , Splits tail | split = TSplitsCons ( head , tail ) |
869
+ index = 0 and result = head .toString ( ) and result != ""
870
+ or
871
+ index > 0 and result = getSplitStringAt ( tail , index - 1 )
872
+ )
873
+ }
874
+
875
+ private string getSplitsStringPart ( Splits splits , int index ) {
876
+ isFullyConstructedSplits ( splits ) and
877
+ result = getSplitStringAt ( splits , index )
878
+ }
879
+
860
880
cached
861
881
string splitsToString ( Splits splits ) {
862
- splits = TSplitsNil ( ) and
863
- result = ""
864
- or
865
- exists ( SplitImpl head , Splits tail , string headString , string tailString |
866
- splits = TSplitsCons ( head , tail )
867
- |
868
- headString = head .toString ( ) and
869
- tailString = tail .toString ( ) and
870
- if tailString = ""
871
- then result = headString
872
- else
873
- if headString = ""
874
- then result = tailString
875
- else result = headString + ", " + tailString
876
- )
882
+ result =
883
+ concat ( string child , int index |
884
+ child = getSplitsStringPart ( splits , index )
885
+ |
886
+ child , ", " order by index
887
+ )
877
888
}
878
889
879
890
/**
0 commit comments