1.1 --- a/common.py Sat Oct 29 22:56:23 2016 +0200
1.2 +++ b/common.py Sun Oct 30 00:51:06 2016 +0200
1.3 @@ -643,7 +643,7 @@
1.4 elif path:
1.5 return path
1.6
1.7 - # Otherwise, establish a name in the current (module) namespace.
1.8 + # Otherwise, establish a name in the current namespace.
1.9
1.10 else:
1.11 return self.get_object_path(name)
2.1 --- a/inspector.py Sat Oct 29 22:56:23 2016 +0200
2.2 +++ b/inspector.py Sun Oct 30 00:51:06 2016 +0200
2.3 @@ -1264,7 +1264,7 @@
2.4
2.5 if not self.in_function and name not in predefined_constants:
2.6 if self.in_class:
2.7 - ref = self.get_object(self.get_object_path(name))
2.8 + ref = self.get_object(self.get_object_path(name), False)
2.9 if not ref:
2.10 ref = self.get_global_or_builtin(name)
2.11
3.1 --- a/modules.py Sat Oct 29 22:56:23 2016 +0200
3.2 +++ b/modules.py Sun Oct 30 00:51:06 2016 +0200
3.3 @@ -304,19 +304,22 @@
3.4 self.queue_module(module_name, True)
3.5 return Reference("<class>", "__builtins__.%s.%s" % (name, name))
3.6
3.7 - def get_object(self, path):
3.8 + def get_object(self, path, defer=True):
3.9
3.10 """
3.11 Get the details of an object with the given 'path'. Where the object
3.12 - cannot be resolved, an unresolved reference is returned.
3.13 + cannot be resolved, an unresolved reference is returned if 'defer' is
3.14 + set to a true value (the default). Otherwise, None is returned.
3.15 """
3.16
3.17 if self.objects.has_key(path):
3.18 return self.objects[path]
3.19 - else:
3.20 + elif defer:
3.21 ref = Reference("<depends>", path)
3.22 self.deferred.append(ref)
3.23 return ref
3.24 + else:
3.25 + return None
3.26
3.27 def import_name_from_module(self, name, module_name):
3.28
4.1 --- a/translator.py Sat Oct 29 22:56:23 2016 +0200
4.2 +++ b/translator.py Sun Oct 30 00:51:06 2016 +0200
4.3 @@ -91,7 +91,7 @@
4.4
4.5 # Determine whether a qualified name is involved.
4.6
4.7 - t = (self.expr and self.get_name() or self.name).rsplit(".", 1)
4.8 + t = (self.get_name() or self.name).rsplit(".", 1)
4.9 parent = len(t) > 1 and t[0] or None
4.10 attrname = encode_path(t[-1])
4.11
4.12 @@ -122,6 +122,14 @@
4.13 context = ref.has_kind("<function>") and encode_path(parent) or None
4.14 return "((__attr) {%s, &%s})" % (context and "&%s" % context or "0", static_name)
4.15
4.16 + # Qualified names must be converted into parent-relative accesses.
4.17 +
4.18 + elif parent:
4.19 + return "__load_via_object(&%s, %s)" % (
4.20 + encode_path(parent), encode_symbol("pos", attrname))
4.21 +
4.22 + # All other accesses involve the names as they were given.
4.23 +
4.24 else:
4.25 return attrname
4.26
4.27 @@ -603,7 +611,7 @@
4.28 # the complete access.
4.29
4.30 name_ref = attr_expr and attr_expr.is_name() and attr_expr
4.31 - name = name_ref and name_ref.name or None
4.32 + name = name_ref and self.get_name_for_tracking(name_ref.name, name_ref and name_ref.final()) or None
4.33
4.34 location = self.get_access_location(name)
4.35 refs = self.get_referenced_attributes(location)
4.36 @@ -1028,12 +1036,12 @@
4.37 # as in the inspector.
4.38
4.39 path = self.get_object_path(n.name)
4.40 - ref = self.importer.get_object(path)
4.41 - name = self.get_name_for_tracking(n.name, ref and ref.final())
4.42
4.43 # Get the static identity of the name.
4.44
4.45 ref = self.importer.identify(path)
4.46 + if ref and not ref.get_name():
4.47 + ref = ref.alias(path)
4.48
4.49 # Obtain any resolved names for non-assignment names.
4.50
4.51 @@ -1045,7 +1053,7 @@
4.52 # static namespace members. The reference should be configured to return
4.53 # such names.
4.54
4.55 - return TrResolvedNameRef(name, ref, expr=expr)
4.56 + return TrResolvedNameRef(n.name, ref, expr=expr)
4.57
4.58 def process_not_node(self, n):
4.59