mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-24 17:28:36 +08:00
Now most tests pass and we're able to continue getting rid of parsing.representation.Name.
This commit is contained in:
@@ -180,7 +180,7 @@ class Script(object):
|
|||||||
comp_dct = {}
|
comp_dct = {}
|
||||||
for c, s in set(completions):
|
for c, s in set(completions):
|
||||||
# TODO Remove this line. c should be a namepart even before that.
|
# TODO Remove this line. c should be a namepart even before that.
|
||||||
if isinstance(c, pr.Name):
|
if c.isinstance(pr.Name):
|
||||||
c = c.names[-1]
|
c = c.names[-1]
|
||||||
n = str(c)
|
n = str(c)
|
||||||
if settings.case_insensitive_completion \
|
if settings.case_insensitive_completion \
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
|||||||
# Only names with the selfname are being added.
|
# Only names with the selfname are being added.
|
||||||
# It is also important, that they have a len() of 2,
|
# It is also important, that they have a len() of 2,
|
||||||
# because otherwise, they are just something else
|
# because otherwise, they are just something else
|
||||||
|
if isinstance(n, pr.NamePart):
|
||||||
|
# NamePart currently means a function
|
||||||
|
# TODO change this branch to scan properly for self names.
|
||||||
|
continue
|
||||||
if unicode(n.names[0]) == self_name and len(n.names) == 2:
|
if unicode(n.names[0]) == self_name and len(n.names) == 2:
|
||||||
add_self_dot_name(n)
|
add_self_dot_name(n)
|
||||||
|
|
||||||
@@ -243,7 +247,12 @@ def get_instance_el(evaluator, instance, var, is_class_var=False):
|
|||||||
untouched.
|
untouched.
|
||||||
"""
|
"""
|
||||||
if isinstance(var, (Instance, compiled.CompiledObject, pr.Operator, Token,
|
if isinstance(var, (Instance, compiled.CompiledObject, pr.Operator, Token,
|
||||||
pr.Module, FunctionExecution)):
|
pr.Module, FunctionExecution, pr.NamePart)):
|
||||||
|
if isinstance(var, pr.NamePart):
|
||||||
|
# TODO temp solution, remove later, NameParts should never get
|
||||||
|
# here.
|
||||||
|
par = get_instance_el(evaluator, instance, var.parent, is_class_var)
|
||||||
|
return helpers.FakeName(unicode(var), par, var.start_pos)
|
||||||
return var
|
return var
|
||||||
|
|
||||||
var = wrap(evaluator, var)
|
var = wrap(evaluator, var)
|
||||||
@@ -275,6 +284,9 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
|
|||||||
return par
|
return par
|
||||||
|
|
||||||
def get_parent_until(self, *args, **kwargs):
|
def get_parent_until(self, *args, **kwargs):
|
||||||
|
if isinstance(self.var, pr.NamePart):
|
||||||
|
# TODO NameParts should never even be InstanceElements
|
||||||
|
return pr.Simple.get_parent_until(self.parent, *args, **kwargs)
|
||||||
return pr.Simple.get_parent_until(self, *args, **kwargs)
|
return pr.Simple.get_parent_until(self, *args, **kwargs)
|
||||||
|
|
||||||
def get_definition(self):
|
def get_definition(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user