Python: fix VariableWrite and remove unneded step

This commit is contained in:
Rasmus Lerchedahl Petersen
2023-12-20 15:44:00 +01:00
parent d039ceb689
commit 0f89f69555
2 changed files with 1 additions and 9 deletions

View File

@@ -300,14 +300,6 @@ module LocalFlow {
nodeTo.(CfgNode).getNode() = def.getDefiningNode()
)
or
// Assignment to captured variables
// These are not covered by the `AssignmentDefinition`s in the case above,
// as they are not necessarily live.
nodeFrom.(CfgNode).getNode() = nodeTo.(CfgNode).getNode().(DefinitionNode).getValue() and
nodeTo.asExpr() = any(VariableCapture::CapturedVariable c).getAStore() and
// Exclude assignments to parameters. These are from default values and not local.
not nodeTo instanceof ParameterNode
or
// With definition
// `with f(42) as x:`
// nodeFrom is `f(42)`

View File

@@ -72,7 +72,7 @@ private module CaptureInput implements Shared::InputSig<Location> {
class VariableWrite extends ControlFlowNode {
CapturedVariable v;
VariableWrite() { this = v.getAStore().getAFlowNode() }
VariableWrite() { this = v.getAStore().getAFlowNode().(DefinitionNode).getValue() }
CapturedVariable getVariable() { result = v }