forked from VimPlug/jedi
follow_call -> eval_call
This commit is contained in:
@@ -515,7 +515,7 @@ class Script(object):
|
|||||||
|
|
||||||
user_stmt = self._user_stmt()
|
user_stmt = self._user_stmt()
|
||||||
with common.scale_speed_settings(settings.scale_call_signatures):
|
with common.scale_speed_settings(settings.scale_call_signatures):
|
||||||
_callable = lambda: self._evaluator.follow_call(call)
|
_callable = lambda: self._evaluator.eval_call(call)
|
||||||
origins = cache.cache_call_signatures(_callable, user_stmt)
|
origins = cache.cache_call_signatures(_callable, user_stmt)
|
||||||
debug.speed('func_call followed')
|
debug.speed('func_call followed')
|
||||||
|
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ To *visualize* this (simplified):
|
|||||||
- ``eval_statement`` - ``<Statement: datetime.date>``
|
- ``eval_statement`` - ``<Statement: datetime.date>``
|
||||||
|
|
||||||
- Unpacking of the statement into ``[[<Call: datetime.date>]]``
|
- Unpacking of the statement into ``[[<Call: datetime.date>]]``
|
||||||
- ``follow_call_list``, calls ``follow_call`` with ``<Call: datetime.date>``
|
- ``follow_call_list``, calls ``eval_call`` with ``<Call: datetime.date>``
|
||||||
- ``follow_call`` - searches the ``datetime`` name within the module.
|
- ``eval_call`` - searches the ``datetime`` name within the module.
|
||||||
|
|
||||||
This is exactly where it starts to get complicated. Now recursions start to
|
This is exactly where it starts to get complicated. Now recursions start to
|
||||||
kick in. The statement has not been resolved fully, but now we need to resolve
|
kick in. The statement has not been resolved fully, but now we need to resolve
|
||||||
the datetime import. So it continues
|
the datetime import. So it continues
|
||||||
|
|
||||||
- follow import, which happens in the :mod:`imports` module.
|
- follow import, which happens in the :mod:`imports` module.
|
||||||
- now the same ``follow_call`` as above calls ``follow_paths`` to follow the
|
- now the same ``eval_call`` as above calls ``follow_paths`` to follow the
|
||||||
second part of the statement ``date``.
|
second part of the statement ``date``.
|
||||||
- After ``follow_paths`` returns with the desired ``datetime.date`` class, the
|
- After ``follow_paths`` returns with the desired ``datetime.date`` class, the
|
||||||
result is being returned and the recursion finishes.
|
result is being returned and the recursion finishes.
|
||||||
@@ -562,7 +562,7 @@ class Evaluator(object):
|
|||||||
if str(call.name) == 'else':
|
if str(call.name) == 'else':
|
||||||
break
|
break
|
||||||
continue
|
continue
|
||||||
result += self.follow_call(call)
|
result += self.eval_call(call)
|
||||||
elif call == '*':
|
elif call == '*':
|
||||||
if [r for r in result if isinstance(r, er.Array)
|
if [r for r in result if isinstance(r, er.Array)
|
||||||
or isinstance(r, er.Instance)
|
or isinstance(r, er.Instance)
|
||||||
@@ -571,7 +571,7 @@ class Evaluator(object):
|
|||||||
next(calls_iterator)
|
next(calls_iterator)
|
||||||
return set(result)
|
return set(result)
|
||||||
|
|
||||||
def follow_call(self, call):
|
def eval_call(self, call):
|
||||||
"""Follow a call is following a function, variable, string, etc."""
|
"""Follow a call is following a function, variable, string, etc."""
|
||||||
path = call.generate_call_path()
|
path = call.generate_call_path()
|
||||||
|
|
||||||
@@ -630,7 +630,7 @@ class Evaluator(object):
|
|||||||
foo.bar.baz
|
foo.bar.baz
|
||||||
|
|
||||||
`follow_path` is only responsible for completing `.bar.baz`, the rest is
|
`follow_path` is only responsible for completing `.bar.baz`, the rest is
|
||||||
done in the `follow_call` function.
|
done in the `eval_call` function.
|
||||||
"""
|
"""
|
||||||
# current is either an Array or a Scope.
|
# current is either an Array or a Scope.
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ def _check_isinstance_type(evaluator, stmt, search_name):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for c in evaluator.follow_call(classes[0]):
|
for c in evaluator.eval_call(classes[0]):
|
||||||
if isinstance(c, er.Array):
|
if isinstance(c, er.Array):
|
||||||
result += c.get_index_types()
|
result += c.get_index_types()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user