@@ -152,17 +152,17 @@ class NonLocalVariable extends SsaSourceVariable {
152
152
}
153
153
154
154
override ControlFlowNode getAnImplicitUse ( ) {
155
- result .( CallNode ) .getScope ( ) .getScope * ( ) = this .( LocalVariable ) . getScope ( )
155
+ result .( CallNode ) .getScope ( ) .getScope * ( ) = this .scope_as_local_variable ( )
156
156
}
157
157
158
158
override ControlFlowNode getScopeEntryDefinition ( ) {
159
159
exists ( Function f |
160
- f .getScope + ( ) = this .( LocalVariable ) . getScope ( ) and
160
+ f .getScope + ( ) = this .scope_as_local_variable ( ) and
161
161
f .getEntryNode ( ) = result
162
162
)
163
163
or
164
164
not this .( LocalVariable ) .isParameter ( ) and
165
- this .( LocalVariable ) . getScope ( ) .getEntryNode ( ) = result
165
+ this .scope_as_local_variable ( ) .getEntryNode ( ) = result
166
166
}
167
167
168
168
pragma [ noinline]
@@ -215,12 +215,15 @@ class ModuleVariable extends SsaSourceVariable {
215
215
)
216
216
}
217
217
218
+ pragma [ nomagic]
219
+ private Scope scope_as_global_variable ( ) { result = this .( GlobalVariable ) .getScope ( ) }
220
+
218
221
pragma [ noinline]
219
- CallNode global_variable_callnode ( ) { result .getScope ( ) = this .( GlobalVariable ) . getScope ( ) }
222
+ CallNode global_variable_callnode ( ) { result .getScope ( ) = this .scope_as_global_variable ( ) }
220
223
221
224
pragma [ noinline]
222
225
ImportMemberNode global_variable_import ( ) {
223
- result .getScope ( ) = this .( GlobalVariable ) . getScope ( ) and
226
+ result .getScope ( ) = this .scope_as_global_variable ( ) and
224
227
import_from_dot_in_init ( result .getModule ( this .getName ( ) ) )
225
228
}
226
229
@@ -250,7 +253,7 @@ class ModuleVariable extends SsaSourceVariable {
250
253
override ControlFlowNode getScopeEntryDefinition ( ) {
251
254
exists ( Scope s | s .getEntryNode ( ) = result |
252
255
/* Module entry point */
253
- this .( GlobalVariable ) . getScope ( ) = s
256
+ this .scope_as_global_variable ( ) = s
254
257
or
255
258
/* For implicit use of __metaclass__ when constructing class */
256
259
class_with_global_metaclass ( s , this )
@@ -286,13 +289,13 @@ class EscapingGlobalVariable extends ModuleVariable {
286
289
override ControlFlowNode getAnImplicitUse ( ) {
287
290
result = ModuleVariable .super .getAnImplicitUse ( )
288
291
or
289
- result .( CallNode ) .getScope ( ) .getScope + ( ) = this .( GlobalVariable ) . getScope ( )
292
+ result .( CallNode ) .getScope ( ) .getScope + ( ) = this .scope_as_global_variable ( )
290
293
or
291
294
result = this .innerScope ( ) .getANormalExit ( )
292
295
}
293
296
294
297
private Scope innerScope ( ) {
295
- result .getScope + ( ) = this .( GlobalVariable ) . getScope ( ) and
298
+ result .getScope + ( ) = this .scope_as_global_variable ( ) and
296
299
not result instanceof ImportTimeScope
297
300
}
298
301
0 commit comments