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):
|
def get_function_execution(self, arguments):
|
||||||
return InstanceFunctionExecution(
|
return InstanceFunctionExecution(
|
||||||
self._instance,
|
self._instance,
|
||||||
self._class_context.parent_context,
|
self.parent_context,
|
||||||
self.funcdef,
|
self.funcdef,
|
||||||
arguments
|
arguments
|
||||||
)
|
)
|
||||||
@@ -289,9 +289,16 @@ class LazyInstanceClassName(LazyInstanceName):
|
|||||||
def infer(self):
|
def infer(self):
|
||||||
for v in super(LazyInstanceClassName, self).infer():
|
for v in super(LazyInstanceClassName, self).infer():
|
||||||
if isinstance(v, er.FunctionContext):
|
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(
|
yield BoundMethod(
|
||||||
v.evaluator, self._instance, self.class_context,
|
v.evaluator, self._instance, self.class_context,
|
||||||
v.parent_context, v.funcdef
|
parent_context, v.funcdef
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
yield v
|
yield v
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ def _evaluate_for_annotation(context, annotation, index=None):
|
|||||||
if index is not None:
|
if index is not None:
|
||||||
definitions = list(itertools.chain.from_iterable(
|
definitions = list(itertools.chain.from_iterable(
|
||||||
definition.py__getitem__(index) for definition in definitions
|
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))
|
len(list(definition.py__iter__())) >= index))
|
||||||
return unite(d.execute_evaluated() for d in definitions)
|
return unite(d.execute_evaluated() for d in definitions)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user