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.
|
# Only the names defined in the last position are valid definitions.
|
||||||
last_names = []
|
last_names = []
|
||||||
for name in reversed(sorted(names, key=lambda name: name.start_pos)):
|
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)
|
last_names.append(name)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -102,6 +103,7 @@ class NameFinder(object):
|
|||||||
origin_scope = None
|
origin_scope = None
|
||||||
stmt = name.get_definition()
|
stmt = name.get_definition()
|
||||||
if isinstance(stmt.parent, compiled.CompiledObject):
|
if isinstance(stmt.parent, compiled.CompiledObject):
|
||||||
|
# TODO seriously? this is stupid.
|
||||||
continue
|
continue
|
||||||
check = flow_analysis.break_check(self._evaluator, scope, stmt, origin_scope)
|
check = flow_analysis.break_check(self._evaluator, scope, stmt, origin_scope)
|
||||||
if check is not flow_analysis.UNREACHABLE:
|
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]
|
args = [obj, obj.base] if isinstance(obj, Instance) else [compiled.none_obj, obj]
|
||||||
return self.execute_subscope_by_name('__get__', *args)
|
return self.execute_subscope_by_name('__get__', *args)
|
||||||
|
|
||||||
@memoize_default([])
|
@underscore_memoization
|
||||||
def names_dicts(self):
|
def names_dicts(self):
|
||||||
yield self._self_names_dict()
|
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):
|
if isinstance(var, pr.Name):
|
||||||
# TODO temp solution, remove later, Name should never get
|
# TODO temp solution, remove later, Name should never get
|
||||||
# here?
|
# 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 InstanceName(var, parent)
|
||||||
return var
|
return var
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user