Python: Move not this instanceof ParameterDefinition logic

This commit is contained in:
Rasmus Wriedt Larsen
2023-07-12 11:31:27 +02:00
parent 83ca47f32c
commit 98ed5cf522
2 changed files with 7 additions and 3 deletions

View File

@@ -501,8 +501,7 @@ class AssignmentDefinition extends EssaNodeDefinition {
ControlFlowNode value;
AssignmentDefinition() {
SsaSource::assignment_definition(this.getSourceVariable(), this.getDefiningNode(), value) and
not this instanceof ParameterDefinition
SsaSource::assignment_definition(this.getSourceVariable(), this.getDefiningNode(), value)
}
ControlFlowNode getValue() { result = value }

View File

@@ -20,7 +20,12 @@ module SsaSource {
/** Holds if `v` is defined by assignment at `defn` and given `value`. */
cached
predicate assignment_definition(Variable v, ControlFlowNode defn, ControlFlowNode value) {
defn.(NameNode).defines(v) and defn.(DefinitionNode).getValue() = value
defn.(NameNode).defines(v) and
defn.(DefinitionNode).getValue() = value and
// since parameter will be considered a DefinitionNode, if it has a default value,
// we need to exclude it here since it is already covered by parameter_definition
// (and points-to was unhappy that it was included in both)
not parameter_definition(v, defn)
}
/** Holds if `v` is defined by assignment of the captured exception. */