mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Cleanup, docs, and an extra test case
This commit is contained in:
@@ -240,6 +240,7 @@ class DataFlowClassValue extends DataFlowCallable, TClassValue {
|
||||
override string getName() { result = c.getName() }
|
||||
}
|
||||
|
||||
/** A class representing the scope in which a `ModuleVariableNode` appears. */
|
||||
class DataFlowModuleScope extends DataFlowCallable, TModule {
|
||||
Module mod;
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ class ParameterNode extends EssaNode {
|
||||
override DataFlowCallable getEnclosingCallable() { this.isParameterOf(result, _) }
|
||||
}
|
||||
|
||||
/** A data flow node corresponding to a module-level (global) variable that is accessed outside of the module scope. */
|
||||
class ModuleVariableNode extends Node, TModuleVariableNode {
|
||||
Module mod;
|
||||
GlobalVariable var;
|
||||
@@ -176,10 +177,8 @@ class ModuleVariableNode extends Node, TModuleVariableNode {
|
||||
}
|
||||
|
||||
/** Gets an `EssaNode` that corresponds to an assignment of this global variable. */
|
||||
Node getAWrite() {
|
||||
exists(DefinitionNode defn |
|
||||
result.asVar().getDefinition().(EssaNodeDefinition).definedBy(var, defn)
|
||||
)
|
||||
EssaNode getAWrite() {
|
||||
result.asVar().getDefinition().(EssaNodeDefinition).definedBy(var, any(DefinitionNode defn))
|
||||
}
|
||||
|
||||
override DataFlowCallable getEnclosingCallable() { result.(DataFlowModuleScope).getScope() = mod }
|
||||
|
||||
Reference in New Issue
Block a user