Python: Introduce TypeBackTracker::getACompatibleTypeTracker()

This commit is contained in:
Tom Hvitved
2021-10-12 16:20:07 +02:00
parent 73fd66cfed
commit 660398aa78

View File

@@ -465,6 +465,19 @@ class TypeBackTracker extends TTypeBackTracker {
simpleLocalFlowStep(nodeFrom, nodeTo) and
this = result
}
/**
* Gets a forwards summary that is compatible with this backwards summary.
* That is, if this summary describes the steps needed to back-track a value
* from `sink` to `mid`, and the result is a valid summary of the steps needed
* to track a value from `source` to `mid`, then the value from `source` may
* also flow to `sink`.
*/
TypeTracker getACompatibleTypeTracker() {
exists(boolean hasCall | result = MkTypeTracker(hasCall, content) |
hasCall = false or hasReturn() = false
)
}
}
/** Provides predicates for implementing custom `TypeBackTracker`s. */