@@ -764,18 +764,20 @@ module TypeTracking<TypeTrackingInput I> {
764764 * in a source-sink path and calculates the set of source-sink pairs.
765765 */
766766 module Graph< endpoint / 1 sink> {
767- private newtype TPathNode = MkPathNode ( Node node , TypeTracker tt ) { node = flow ( tt ) }
767+ private newtype TPathNode =
768+ TPathNodeMid ( Node node , TypeTracker tt ) { node = flow ( tt ) } or
769+ TPathNodeSink ( Node node ) { sink ( node ) and flowsTo ( node ) }
768770
769771 /**
770772 * A node on a path that is reachable from a source. This is a pair of a
771- * `Node` and a `TypeTracker`.
773+ * `Node` and a `TypeTracker` except at sinks for which there is no `TypeTracker` .
772774 */
773775 class PathNodeFwd extends TPathNode {
774776 /** Gets the node of this `PathNode`. */
775- Node getNode ( ) { this = MkPathNode ( result , _) }
777+ Node getNode ( ) { this = TPathNodeMid ( result , _) or this = TPathNodeSink ( result ) }
776778
777- /** Gets the typetracker of this `PathNode`. */
778- TypeTracker getTypeTracker ( ) { this = MkPathNode ( _, result ) }
779+ /** Gets the typetracker of this `PathNode`, if any . */
780+ TypeTracker getTypeTracker ( ) { this = TPathNodeMid ( _, result ) }
779781
780782 private string ppContent ( ) {
781783 exists ( ContentOption c | this .getTypeTracker ( ) = MkTypeTracker ( _, c ) |
@@ -784,6 +786,8 @@ module TypeTracking<TypeTrackingInput I> {
784786 c instanceof ContentOption:: None and
785787 result = ""
786788 )
789+ or
790+ result = "" and this instanceof TPathNodeSink
787791 }
788792
789793 /** Gets a textual representation of this node. */
@@ -793,7 +797,7 @@ module TypeTracking<TypeTrackingInput I> {
793797 predicate isSource ( ) { source ( this .getNode ( ) ) and this .getTypeTracker ( ) .start ( ) }
794798
795799 /** Holds if this is a sink. */
796- predicate isSink ( ) { sink ( this . getNode ( ) ) and this . getTypeTracker ( ) . end ( ) }
800+ predicate isSink ( ) { this instanceof TPathNodeSink }
797801 }
798802
799803 private predicate edgeCand ( Node n1 , TypeTracker tt1 , Node n2 , TypeTracker tt2 ) {
@@ -802,7 +806,17 @@ module TypeTracking<TypeTrackingInput I> {
802806 }
803807
804808 private predicate edgeCand ( PathNodeFwd n1 , PathNodeFwd n2 ) {
805- edgeCand ( n1 .getNode ( ) , n1 .getTypeTracker ( ) , n2 .getNode ( ) , n2 .getTypeTracker ( ) )
809+ exists ( PathNodeFwd tgt |
810+ edgeCand ( n1 .getNode ( ) , n1 .getTypeTracker ( ) , tgt .getNode ( ) , tgt .getTypeTracker ( ) )
811+ |
812+ n2 = tgt
813+ or
814+ n2 = TPathNodeSink ( tgt .getNode ( ) ) and tgt .getTypeTracker ( ) .end ( )
815+ )
816+ or
817+ n1 .getTypeTracker ( ) .end ( ) and
818+ flowsTo ( n1 .getNode ( ) , n2 .getNode ( ) ) and
819+ n2 instanceof TPathNodeSink
806820 }
807821
808822 private predicate reachRev ( PathNodeFwd n ) {
0 commit comments