mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Add getLocation to EssaVariable.
This may be a slightly "bogus" location to provide for ESSA variables, but it can be useful for debugging. For instance, where previously you might just see ``` SSA variable x | ... SSA variable x | ... SSA variable x | ... SSA variable x | ... SSA variable x | ... SSA variable x | ... ``` where each instance of `SSA variable x` was just a bare string, now each occurrence will tell you (via its location) _where_ this variable is being (re)defined.
This commit is contained in:
@@ -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() }
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user