зеркало из https://github.com/github/codeql.git
Merge pull request #9858 from tausbn/python-fix-bad-getOuterVariable-join
Python: Fix bad join in `getOuterVariable`
This commit is contained in:
Коммит
e7c6c04076
|
@ -26,9 +26,21 @@ class ImportTimeScope extends Scope {
|
|||
|
||||
/** Gets the global variable that is used during lookup, should `var` be undefined. */
|
||||
GlobalVariable getOuterVariable(LocalVariable var) {
|
||||
this instanceof Class and
|
||||
var.getScope() = this and
|
||||
result.getScope() = this.getEnclosingModule() and
|
||||
var.getId() = result.getId()
|
||||
exists(string name |
|
||||
class_var_scope(this, name, var) and
|
||||
global_var_scope(name, this.getEnclosingModule(), result)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private predicate global_var_scope(string name, Scope scope, GlobalVariable var) {
|
||||
var.getScope() = scope and
|
||||
var.getId() = name
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private predicate class_var_scope(Class cls, string name, LocalVariable var) {
|
||||
var.getScope() = cls and
|
||||
var.getId() = name
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче