Capture flow: Take overwrites in nested scopes into account

This commit is contained in:
Tom Hvitved
2024-02-07 14:06:08 +01:00
parent 0c43ad45b4
commit 1ea7717714
6 changed files with 28 additions and 4 deletions

View File

@@ -453,6 +453,10 @@ module VariableCapture {
Flow::localFlowStep(asClosureNode(node1), asClosureNode(node2))
}
predicate clearsContent(Node node, Content::CapturedVariableContent c) {
Flow::clearsContent(asClosureNode(node), c.getVariable())
}
class CapturedSsaDefinitionExt extends SsaImpl::DefinitionExt {
CapturedSsaDefinitionExt() { this.getSourceVariable() instanceof CapturedVariable }
}
@@ -1930,6 +1934,8 @@ predicate clearsContent(Node n, ContentSet c) {
c.isKnownOrUnknownElement(TKnownElementContent(cv)) and
cv.isSymbol(name)
)
or
VariableCapture::clearsContent(n, any(Content::CapturedVariableContent v | c.isSingleton(v)))
}
/**