Merge pull request #5053 from github/python-add-essavariable-locations

Python: Add locations for ESSA variables
This commit is contained in:
yoff
2021-02-01 17:31:25 +01:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -143,7 +143,7 @@ class EssaNode extends Node, TEssaNode {
override Scope getScope() { result = var.getScope() }
override Location getLocation() { result = var.getDefinition().getLocation() }
override Location getLocation() { result = var.getLocation() }
}
/** A data-flow node corresponding to a control-flow node. */

View File

@@ -61,6 +61,13 @@ class EssaVariable extends TEssaDefinition {
* defined by `from ... import *` and the like.
*/
predicate isMetaVariable() { this.getName() = "$" }
/**
* Gets the location of this variable.
*
* Yields the location of the corresponding definition of this variable.
*/
Location getLocation() { result = this.getDefinition().getLocation() }
}
/*