forked from VimPlug/jedi
Fix most instance related issues.
This commit is contained in:
@@ -92,7 +92,8 @@ class NameFinder(object):
|
||||
# Only the names defined in the last position are valid definitions.
|
||||
last_names = []
|
||||
for name in reversed(sorted(names, key=lambda name: name.start_pos)):
|
||||
if isinstance(name, compiled.CompiledName):
|
||||
if isinstance(name, compiled.CompiledName) \
|
||||
or isinstance(name, er.InstanceName) and isinstance(name._origin_name, compiled.CompiledName):
|
||||
last_names.append(name)
|
||||
continue
|
||||
|
||||
@@ -102,6 +103,7 @@ class NameFinder(object):
|
||||
origin_scope = None
|
||||
stmt = name.get_definition()
|
||||
if isinstance(stmt.parent, compiled.CompiledObject):
|
||||
# TODO seriously? this is stupid.
|
||||
continue
|
||||
check = flow_analysis.break_check(self._evaluator, scope, stmt, origin_scope)
|
||||
if check is not flow_analysis.UNREACHABLE:
|
||||
|
||||
@@ -235,7 +235,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
||||
args = [obj, obj.base] if isinstance(obj, Instance) else [compiled.none_obj, obj]
|
||||
return self.execute_subscope_by_name('__get__', *args)
|
||||
|
||||
@memoize_default([])
|
||||
@underscore_memoization
|
||||
def names_dicts(self):
|
||||
yield self._self_names_dict()
|
||||
|
||||
@@ -321,7 +321,7 @@ def get_instance_el(evaluator, instance, var, is_class_var=False):
|
||||
if isinstance(var, pr.Name):
|
||||
# TODO temp solution, remove later, Name should never get
|
||||
# here?
|
||||
parent = get_instance_el(evaluator, instance, var.parent)
|
||||
parent = get_instance_el(evaluator, instance, var.parent, is_class_var)
|
||||
return InstanceName(var, parent)
|
||||
return var
|
||||
|
||||
|
||||
Reference in New Issue
Block a user