1.1 --- a/translator.py Sat Nov 26 23:03:21 2016 +0100
1.2 +++ b/translator.py Sat Nov 26 23:05:45 2016 +0100
1.3 @@ -1190,24 +1190,31 @@
1.4 # Get the appropriate name for the name reference, using the same method
1.5 # as in the inspector.
1.6
1.7 - path = self.get_object_path(n.name)
1.8 + path = self.get_namespace_path()
1.9 + objpath = self.get_object_path(n.name)
1.10 +
1.11 + # Determine any assigned globals.
1.12 +
1.13 + globals = self.importer.get_module(self.name).scope_globals.get(path)
1.14 + if globals and n.name in globals:
1.15 + objpath = self.get_global_path(n.name)
1.16
1.17 # Get the static identity of the name.
1.18
1.19 - ref = self.importer.identify(path)
1.20 + ref = self.importer.identify(objpath)
1.21 if ref and not ref.get_name():
1.22 - ref = ref.alias(path)
1.23 + ref = ref.alias(objpath)
1.24
1.25 # Obtain any resolved names for non-assignment names.
1.26
1.27 if not expr and not ref and self.in_function:
1.28 - locals = self.importer.function_locals.get(self.get_namespace_path())
1.29 + locals = self.importer.function_locals.get(path)
1.30 ref = locals and locals.get(n.name)
1.31
1.32 # Determine whether the name refers to a parameter. The generation of
1.33 # parameter references is different from other names.
1.34
1.35 - parameters = self.importer.function_parameters.get(self.get_namespace_path())
1.36 + parameters = self.importer.function_parameters.get(path)
1.37 parameter = n.name == "self" and self.in_method() or \
1.38 parameters and n.name in parameters
1.39