1.1 --- a/importer.py Sat Sep 03 22:43:44 2016 +0200
1.2 +++ b/importer.py Sat Sep 03 23:57:34 2016 +0200
1.3 @@ -24,6 +24,7 @@
1.4 from os.path import exists, extsep, getmtime, join
1.5 from os import listdir, makedirs, remove
1.6 from common import init_item, readfile, writefile
1.7 +from modules import CachedModule
1.8 from referencing import Reference
1.9 import inspector
1.10 import sys
1.11 @@ -633,7 +634,7 @@
1.12 module = self.modules.get(module_name)
1.13
1.14 if not module and not self.source_is_new(filename, module_name):
1.15 - module = inspector.CachedModule(module_name, self)
1.16 + module = CachedModule(module_name, self)
1.17 self.add_module(module_name, module)
1.18
1.19 filename = join(self.cache, module_name)
2.1 --- a/inspector.py Sat Sep 03 22:43:44 2016 +0200
2.2 +++ b/inspector.py Sat Sep 03 23:57:34 2016 +0200
2.3 @@ -35,8 +35,10 @@
2.4 "A module inspector."
2.5
2.6 def __init__(self, name, importer):
2.7 +
2.8 + "Initialise the module with basic details."
2.9 +
2.10 BasicModule.__init__(self, name, importer)
2.11 - NameResolving.__init__(self)
2.12
2.13 self.in_class = False
2.14 self.in_conditional = False
2.15 @@ -642,7 +644,7 @@
2.16 if not alias and len(n.names) > 1:
2.17 raise InspectError("Imported modules must be aliased unless a simple module is imported.", path, n)
2.18
2.19 - self.set_module(alias or name.split(".")[0], name)
2.20 + self.set_module(alias or name.split(".")[-1], name)
2.21 self.importer.queue_module(name, self)
2.22
2.23 def process_invocation_node(self, n):
3.1 --- a/modules.py Sat Sep 03 22:43:44 2016 +0200
3.2 +++ b/modules.py Sat Sep 03 23:57:34 2016 +0200
3.3 @@ -20,7 +20,7 @@
3.4 this program. If not, see <http://www.gnu.org/licenses/>.
3.5 """
3.6
3.7 -from common import CommonModule
3.8 +from common import init_item, CommonModule
3.9 from encoders import decode_modifier_term, encode_modifiers, encode_usage
3.10 from referencing import decode_reference, Reference
3.11 from results import ResolvedNameRef
3.12 @@ -84,6 +84,15 @@
3.13
3.14 self.attr_access_modifiers = {}
3.15
3.16 + # Name resolution details.
3.17 +
3.18 + self.name_references = {} # references to globals
3.19 +
3.20 + # Initialisation-related details.
3.21 +
3.22 + self.initialised_names = {}
3.23 + self.aliased_names = {}
3.24 +
3.25 def __repr__(self):
3.26 return "BasicModule(%r, %r)" % (self.name, self.importer)
3.27
4.1 --- a/resolving.py Sat Sep 03 22:43:44 2016 +0200
4.2 +++ b/resolving.py Sat Sep 03 23:57:34 2016 +0200
4.3 @@ -29,14 +29,6 @@
4.4
4.5 "Resolving names mix-in for inspected modules."
4.6
4.7 - def __init__(self):
4.8 - self.name_references = {} # references to globals
4.9 -
4.10 - # Initialisation-related details.
4.11 -
4.12 - self.initialised_names = {}
4.13 - self.aliased_names = {}
4.14 -
4.15 # Object resolution.
4.16
4.17 def resolve_object(self, ref):