Skip to content

Commit c0511ca

Browse files
authored
Merge pull request #5053 from github/python-add-essavariable-locations
Python: Add locations for ESSA variables
2 parents 700a2db + fc01e56 commit c0511ca

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class EssaNode extends Node, TEssaNode {
143143

144144
override Scope getScope() { result = var.getScope() }
145145

146-
override Location getLocation() { result = var.getDefinition().getLocation() }
146+
override Location getLocation() { result = var.getLocation() }
147147
}
148148

149149
/** A data-flow node corresponding to a control-flow node. */

python/ql/src/semmle/python/essa/Essa.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ class EssaVariable extends TEssaDefinition {
6161
* defined by `from ... import *` and the like.
6262
*/
6363
predicate isMetaVariable() { this.getName() = "$" }
64+
65+
/**
66+
* Gets the location of this variable.
67+
*
68+
* Yields the location of the corresponding definition of this variable.
69+
*/
70+
Location getLocation() { result = this.getDefinition().getLocation() }
6471
}
6572

6673
/*

0 commit comments

Comments
 (0)