@@ -677,6 +677,27 @@ module MakeModelGenerator<
677677 )
678678 }
679679
680+ private string getReversedHash ( PropagateContentFlow:: AccessPath ap ) {
681+ result = concat ( int i | | getSyntheticName ( ap .getAtIndex ( i ) ) , "" order by i desc )
682+ }
683+
684+ private string getHash ( PropagateContentFlow:: AccessPath ap ) {
685+ result = concat ( int i | | getSyntheticName ( ap .getAtIndex ( i ) ) , "" order by i )
686+ }
687+
688+ /**
689+ * Gets all access paths that contains the synthetic fields
690+ * from `ap` in reverse order (if `ap` contains at least one synthetic field).
691+ * These are the possible candidates for synthetic path continuations.
692+ */
693+ private PropagateContentFlow:: AccessPath getSyntheticPathCandidate (
694+ PropagateContentFlow:: AccessPath ap
695+ ) {
696+ hasSyntheticContent ( ap ) and
697+ hasSyntheticContent ( result ) and
698+ getHash ( ap ) = getReversedHash ( result )
699+ }
700+
680701 /**
681702 * A module containing predicates for validating access paths containing content sets
682703 * that translates into synthetic fields, when used for generated summary models.
@@ -740,7 +761,7 @@ module MakeModelGenerator<
740761 exists ( PropagateContentFlow:: AccessPath mid , Type midType |
741762 hasSyntheticContent ( mid ) and
742763 step ( t , read , midType , mid ) and
743- reachesSynthExit ( midType , mid . reverse ( ) )
764+ reachesSynthExit ( midType , getSyntheticPathCandidate ( mid ) )
744765 )
745766 }
746767
@@ -756,7 +777,7 @@ module MakeModelGenerator<
756777 exists ( PropagateContentFlow:: AccessPath mid , Type midType |
757778 hasSyntheticContent ( mid ) and
758779 step ( midType , mid , t , store ) and
759- synthEntryReaches ( midType , mid . reverse ( ) )
780+ synthEntryReaches ( midType , getSyntheticPathCandidate ( mid ) )
760781 )
761782 }
762783
@@ -785,14 +806,15 @@ module MakeModelGenerator<
785806 Type t1 , PropagateContentFlow:: AccessPath read , Type t2 ,
786807 PropagateContentFlow:: AccessPath store
787808 ) {
788- synthPathEntry ( t1 , read , t2 , store ) and reachesSynthExit ( t2 , store .reverse ( ) )
809+ synthPathEntry ( t1 , read , t2 , store ) and
810+ reachesSynthExit ( t2 , getSyntheticPathCandidate ( store ) )
789811 or
790- exists ( PropagateContentFlow:: AccessPath store0 | store0 . reverse ( ) = read |
812+ exists ( PropagateContentFlow:: AccessPath store0 | getSyntheticPathCandidate ( store0 ) = read |
791813 synthEntryReaches ( t1 , store0 ) and synthPathExit ( t1 , read , t2 , store )
792814 or
793815 synthEntryReaches ( t1 , store0 ) and
794816 step ( t1 , read , t2 , store ) and
795- reachesSynthExit ( t2 , store . reverse ( ) )
817+ reachesSynthExit ( t2 , getSyntheticPathCandidate ( store ) )
796818 )
797819 }
798820 }
0 commit comments