mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-20 04:21:13 +08:00
Get rid of all names_dicts in the completion api.
This commit is contained in:
@@ -234,11 +234,10 @@ class Completion:
|
|||||||
if cls.start_pos[1] >= leaf.start_pos[1]:
|
if cls.start_pos[1] >= leaf.start_pos[1]:
|
||||||
return
|
return
|
||||||
|
|
||||||
names_dicts = cls.names_dicts(search_global=False, is_instance=True)
|
filters = cls.get_filters(search_global=False, is_instance=True)
|
||||||
# The first dict is the dictionary of class itself.
|
# The first dict is the dictionary of class itself.
|
||||||
next(names_dicts)
|
next(filters)
|
||||||
for names_dict in names_dicts:
|
for filter in filters:
|
||||||
for values in names_dict.values():
|
for name in filter.values():
|
||||||
for value in values:
|
if (name.parent.type == 'funcdef') == is_function:
|
||||||
if (value.parent.type == 'funcdef') == is_function:
|
yield name
|
||||||
yield value
|
|
||||||
|
|||||||
@@ -332,8 +332,8 @@ class CompiledObjectFilter(AbstractFilter):
|
|||||||
"""
|
"""
|
||||||
name_class = CompiledName
|
name_class = CompiledName
|
||||||
|
|
||||||
def __init__(self, evaluator, compiled_obj, origin_scope, is_instance=False):
|
def __init__(self, evaluator, compiled_obj, is_instance=False):
|
||||||
super(CompiledObjectFilter, self).__init__(origin_scope)
|
super(CompiledObjectFilter, self).__init__(None)
|
||||||
self._evaluator = evaluator
|
self._evaluator = evaluator
|
||||||
self._compiled_obj = compiled_obj
|
self._compiled_obj = compiled_obj
|
||||||
self._is_instance = is_instance
|
self._is_instance = is_instance
|
||||||
|
|||||||
@@ -554,10 +554,10 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
else:
|
else:
|
||||||
for scope in self.py__mro__():
|
for scope in self.py__mro__():
|
||||||
if isinstance(scope, compiled.CompiledObject):
|
if isinstance(scope, compiled.CompiledObject):
|
||||||
for filter in scope.get_filters():
|
for filter in scope.get_filters(is_instance=is_instance):
|
||||||
yield filter
|
yield filter
|
||||||
else:
|
else:
|
||||||
yield ParserTreeFilter(self._evaluator, self.base)
|
yield ParserTreeFilter(self._evaluator, scope.base)
|
||||||
|
|
||||||
def is_class(self):
|
def is_class(self):
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user