Python: Setup shared read/store steps

This commit is contained in:
Rasmus Wriedt Larsen
2024-02-23 11:44:08 +01:00
parent 636cf611ae
commit 7721fb3331
2 changed files with 18 additions and 0 deletions

View File

@@ -641,11 +641,18 @@ predicate jumpStepNotSharedWithTypeTracker(Node nodeFrom, Node nodeTo) {
//--------
// Field flow
//--------
/**
* Subset of `storeStep` that should be shared with type-tracking.
*/
predicate storeStepCommon(Node nodeFrom, ContentSet c, Node nodeTo) { none() }
/**
* Holds if data can flow from `nodeFrom` to `nodeTo` via an assignment to
* content `c`.
*/
predicate storeStep(Node nodeFrom, ContentSet c, Node nodeTo) {
storeStepCommon(nodeFrom, c, nodeTo)
or
listStoreStep(nodeFrom, c, nodeTo)
or
setStoreStep(nodeFrom, c, nodeTo)
@@ -891,10 +898,17 @@ predicate attributeStoreStep(Node nodeFrom, AttributeContent c, Node nodeTo) {
)
}
/**
* Subset of `readStep` that should be shared with type-tracking.
*/
predicate readStepCommon(Node nodeFrom, ContentSet c, Node nodeTo) { none() }
/**
* Holds if data can flow from `nodeFrom` to `nodeTo` via a read of content `c`.
*/
predicate readStep(Node nodeFrom, ContentSet c, Node nodeTo) {
readStepCommon(nodeFrom, c, nodeTo)
or
subscriptReadStep(nodeFrom, c, nodeTo)
or
iterableUnpackingReadStep(nodeFrom, c, nodeTo)

View File

@@ -175,6 +175,8 @@ module TypeTrackingInput implements Shared::TypeTrackingInput {
nodeTo = a.getObject()
)
or
DataFlowPrivate::storeStepCommon(nodeFrom, content, nodeTo)
or
TypeTrackerSummaryFlow::basicStoreStep(nodeFrom, nodeTo, content)
}
@@ -189,6 +191,8 @@ module TypeTrackingInput implements Shared::TypeTrackingInput {
nodeTo = a
)
or
DataFlowPrivate::readStepCommon(nodeFrom, content, nodeTo)
or
TypeTrackerSummaryFlow::basicLoadStep(nodeFrom, nodeTo, content)
}