Python: Fix tests by managing local sources

`API::Node::getAwaited` is restriced to local sources
This commit is contained in:
Rasmus Lerchedahl Petersen
2021-10-28 13:22:59 +02:00
parent 56dab252c9
commit b3ba75a00f

View File

@@ -175,6 +175,19 @@ module EssaFlow {
contextManager.strictlyDominates(var)
)
or
// Async with var definition
// `async with f(42) as x:`
// nodeFrom is `x`, cfg node
// nodeTo is `x`, essa var
//
// This makes the cfg node the local source of the awaited value.
exists(With with, ControlFlowNode var |
nodeFrom.(CfgNode).getNode() = var and
nodeTo.(EssaNode).getVar().getDefinition().(WithDefinition).getDefiningNode() = var and
with.getOptionalVars() = var.getNode() and
with.isAsync()
)
or
// Parameter definition
// `def foo(x):`
// nodeFrom is `x`, cfgNode