File tree Expand file tree Collapse file tree
ruby/ql/lib/codeql/ruby/typetracking Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ private module Cached {
4141 exists ( TypeTrackerContentSet loadContents |
4242 step = LoadStep ( pragma [ only_bind_into ] ( loadContents ) ) and
4343 tt = MkTypeTracker ( hasCall , storeContents ) and
44- storeContents . getAStoreContent ( ) = loadContents . getAReadContent ( ) and
44+ compatibleContents ( storeContents , loadContents ) and
4545 result = noContentTypeTracker ( hasCall )
4646 )
4747 or
@@ -76,7 +76,7 @@ private module Cached {
7676 exists ( TypeTrackerContentSet storeContents |
7777 step = StoreStep ( pragma [ only_bind_into ] ( storeContents ) ) and
7878 tbt = MkTypeBackTracker ( hasReturn , loadContents ) and
79- storeContents . getAStoreContent ( ) = loadContents . getAReadContent ( ) and
79+ compatibleContents ( storeContents , loadContents ) and
8080 result = noContentTypeBackTracker ( hasReturn )
8181 )
8282 or
Original file line number Diff line number Diff line change @@ -15,17 +15,18 @@ class Node = DataFlowPublic::Node;
1515
1616class TypeTrackingNode = DataFlowPublic:: LocalSourceNode ;
1717
18- private newtype TOptionalTypeTrackerContent =
19- MkAttribute ( string name ) { name = any ( Ast:: SetterMethodCall c ) .getTargetName ( ) } or
20- MkContent ( DataFlowPublic:: Content content ) or
21- MkNoContent ( )
22-
23- class TypeTrackerContent = DataFlowPublic:: Content ;
24-
2518class TypeTrackerContentSet = DataFlowPublic:: ContentSet ;
2619
2720class OptionalTypeTrackerContentSet = DataFlowPublic:: OptionalContentSet ;
2821
22+ /**
23+ * Holds if a value stored with `storeContents` can be read back with `loadContents`.
24+ */
25+ pragma [ inline]
26+ predicate compatibleContents ( TypeTrackerContentSet storeContents , TypeTrackerContentSet loadContents ) {
27+ storeContents .getAStoreContent ( ) = loadContents .getAReadContent ( )
28+ }
29+
2930/** Gets the "no content set" value to use for a type tracker not inside any content. */
3031OptionalTypeTrackerContentSet noContentSet ( ) { result .isNoContentSet ( ) }
3132
You can’t perform that action at this time.
0 commit comments