1
0
forked from VimPlug/jedi

Fix the last remaining issues of the first part of the NamePart switch.

This commit is contained in:
Dave Halter
2014-09-09 15:58:20 +02:00
parent 45e033c50e
commit b68a59daef
5 changed files with 9 additions and 2 deletions

View File

@@ -388,6 +388,7 @@ class Script(object):
if goto_path:
definitions = set(self._prepare_goto(goto_path))
definitions = resolve_import_paths(definitions)
names = [s if isinstance(s, pr.Name) else s.name for s in definitions
if s is not imports.ImportWrapper.GlobalNamespace]
defs = [classes.Definition(self._evaluator, name.names[-1])

View File

@@ -507,6 +507,7 @@ class Completion(BaseDefinition):
the ``foo.docstring(fast=False)`` on every object, because it
parses all libraries starting with ``a``.
"""
definition = self._definition
if isinstance(definition, pr.Import):
i = imports.ImportWrapper(self._evaluator, definition)
if len(i.import_path) > 1 or not fast:

View File

@@ -243,7 +243,7 @@ def save_parser(path, name, parser, pickling=True):
class ParserPickling(object):
version = 16
version = 17
"""
Version number (integer) for file system cache.

View File

@@ -305,7 +305,6 @@ class FakeImport(pr.Import):
class FakeName(pr.Name):
def __init__(self, name_or_names, parent=None, start_pos=(0, 0)):
start_pos = 0, 0
if isinstance(name_or_names, list):
names = [(n, start_pos) for n in name_or_names]
else:

View File

@@ -291,6 +291,12 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
return [get_instance_el(self._evaluator, self.instance, command, self.is_class_var)
for command in self.var.expression_list()]
@property
@underscore_memoization
def name(self):
name = self.var.name
return helpers.FakeName(unicode(name), self, name.start_pos)
def __iter__(self):
for el in self.var.__iter__():
yield get_instance_el(self._evaluator, self.instance, el,