File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
python/ql/lib/semmle/python/types Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,21 @@ class ImportTimeScope extends Scope {
26
26
27
27
/** Gets the global variable that is used during lookup, should `var` be undefined. */
28
28
GlobalVariable getOuterVariable ( LocalVariable var ) {
29
- this instanceof Class and
30
- var . getScope ( ) = this and
31
- result . getScope ( ) = this .getEnclosingModule ( ) and
32
- var . getId ( ) = result . getId ( )
29
+ exists ( string name |
30
+ class_var_scope ( this , name , var ) and
31
+ global_var_scope ( name , this .getEnclosingModule ( ) , result )
32
+ )
33
33
}
34
34
}
35
+
36
+ pragma [ nomagic]
37
+ private predicate global_var_scope ( string name , Scope scope , GlobalVariable var ) {
38
+ var .getScope ( ) = scope and
39
+ var .getId ( ) = name
40
+ }
41
+
42
+ pragma [ nomagic]
43
+ private predicate class_var_scope ( Class cls , string name , LocalVariable var ) {
44
+ var .getScope ( ) = cls and
45
+ var .getId ( ) = name
46
+ }
You can’t perform that action at this time.
0 commit comments