@@ -15,22 +15,22 @@ module ImportStar {
15
15
s = n .getScope ( ) .getEnclosingScope * ( ) and
16
16
exists ( potentialImportStarBase ( s ) ) and
17
17
// Not already defined in an enclosing scope.
18
- not isDefinedLocally ( n , name )
18
+ not isDefinedLocally ( n )
19
19
}
20
20
21
21
/** Holds if `n` refers to a variable that is defined in the module in which it occurs. */
22
- private predicate isDefinedLocally ( NameNode n , string name ) {
22
+ private predicate isDefinedLocally ( NameNode n ) {
23
23
// Defined in an enclosing scope
24
- exists ( LocalVariable v | v .getId ( ) = name and v .getScope ( ) = n .getScope ( ) .getEnclosingScope * ( ) )
24
+ exists ( LocalVariable v | v .getId ( ) = n . getId ( ) and v .getScope ( ) = n .getScope ( ) .getEnclosingScope * ( ) )
25
25
or
26
26
// Defined as a built-in
27
- name = Builtins:: getBuiltinName ( )
27
+ n . getId ( ) = Builtins:: getBuiltinName ( )
28
28
or
29
29
// Defined as a global in this module
30
- globalNameDefinedInModule ( name , n .getEnclosingModule ( ) )
30
+ globalNameDefinedInModule ( n . getId ( ) , n .getEnclosingModule ( ) )
31
31
or
32
32
// A non-built-in that still has file-specific meaning
33
- name in [ "__name__" , "__package__" ]
33
+ n . getId ( ) in [ "__name__" , "__package__" ]
34
34
}
35
35
36
36
/** Holds if a global variable called `name` is assigned a value in the module `m`. */
@@ -50,7 +50,7 @@ module ImportStar {
50
50
predicate importStarResolvesTo ( NameNode n , Module m ) {
51
51
m = getStarImported + ( n .getEnclosingModule ( ) ) and
52
52
globalNameDefinedInModule ( n .getId ( ) , m ) and
53
- not isDefinedLocally ( n , n . getId ( ) )
53
+ not isDefinedLocally ( n )
54
54
}
55
55
56
56
/**
0 commit comments