1.1 --- a/importer.py Thu Nov 10 23:27:13 2016 +0100
1.2 +++ b/importer.py Thu Nov 10 23:55:49 2016 +0100
1.3 @@ -410,11 +410,14 @@
1.4 # Record the resolved names and identify required modules.
1.5
1.6 else:
1.7 + # Find the providing module of this reference.
1.8 + # Where definitive details of the origin cannot be found,
1.9 + # identify the provider using the deferred reference.
1.10 + # NOTE: This may need to test for static origins.
1.11 +
1.12 + provider = self.get_module_provider(found.unresolved() and ref or found)
1.13 ref.mutate(found)
1.14
1.15 - # Find the providing module of this reference.
1.16 -
1.17 - provider = self.get_module_provider(ref)
1.18 if provider:
1.19
1.20 module.required.add(provider)
2.1 --- a/referencing.py Thu Nov 10 23:27:13 2016 +0100
2.2 +++ b/referencing.py Thu Nov 10 23:55:49 2016 +0100
2.3 @@ -90,7 +90,8 @@
2.4 """
2.5 Return whether the reference describes an object from the given 'kinds',
2.6 where such kinds may be "<class>", "<function>", "<instance>",
2.7 - "<module>" or "<var>".
2.8 + "<module>" or "<var>". Unresolved references may also have kinds of
2.9 + "<depends>" and "<invoke>".
2.10 """
2.11
2.12 if not isinstance(kinds, (list, tuple)):
2.13 @@ -103,6 +104,12 @@
2.14
2.15 return self.get_origin().split(".")
2.16
2.17 + def unresolved(self):
2.18 +
2.19 + "Return whether this reference is unresolved."
2.20 +
2.21 + return self.has_kind(["<depends>", "<invoke>"])
2.22 +
2.23 def static(self):
2.24
2.25 "Return this reference if it refers to a static object, None otherwise."