forked from VimPlug/jedi
Fix complex instance name resolving.
This commit is contained in:
@@ -258,7 +258,7 @@ class BoundMethod(er.FunctionContext):
|
||||
def get_function_execution(self, arguments):
|
||||
return InstanceFunctionExecution(
|
||||
self._instance,
|
||||
self._class_context.parent_context,
|
||||
self.parent_context,
|
||||
self.funcdef,
|
||||
arguments
|
||||
)
|
||||
@@ -289,9 +289,16 @@ class LazyInstanceClassName(LazyInstanceName):
|
||||
def infer(self):
|
||||
for v in super(LazyInstanceClassName, self).infer():
|
||||
if isinstance(v, er.FunctionContext):
|
||||
# Classes are never used to resolve anything within the
|
||||
# functions. Only other functions and modules will resolve
|
||||
# those things.
|
||||
parent_context = v.parent_context
|
||||
while isinstance(parent_context, er.ClassContext):
|
||||
parent_context = parent_context.parent_context
|
||||
|
||||
yield BoundMethod(
|
||||
v.evaluator, self._instance, self.class_context,
|
||||
v.parent_context, v.funcdef
|
||||
parent_context, v.funcdef
|
||||
)
|
||||
else:
|
||||
yield v
|
||||
|
||||
@@ -45,7 +45,7 @@ def _evaluate_for_annotation(context, annotation, index=None):
|
||||
if index is not None:
|
||||
definitions = list(itertools.chain.from_iterable(
|
||||
definition.py__getitem__(index) for definition in definitions
|
||||
if definition.type == 'tuple' and
|
||||
if definition.array_type == 'tuple' and
|
||||
len(list(definition.py__iter__())) >= index))
|
||||
return unite(d.execute_evaluated() for d in definitions)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user