forked from VimPlug/jedi
Refactoring: call_of_name -> call_of_leaf.
This commit is contained in:
@@ -6,7 +6,7 @@ from collections import namedtuple
|
||||
|
||||
from jedi import common
|
||||
from jedi.evaluate import imports
|
||||
from jedi.evaluate.helpers import deep_ast_copy, call_of_name
|
||||
from jedi.evaluate.helpers import deep_ast_copy, call_of_leaf
|
||||
from jedi import parser
|
||||
from jedi.parser import tokenize, token
|
||||
|
||||
@@ -181,7 +181,7 @@ def evaluate_goto_definition(evaluator, leaf):
|
||||
if parent.type == 'atom':
|
||||
node = leaf.parent
|
||||
elif parent.type == 'trailer':
|
||||
node = call_of_name(leaf)
|
||||
node = call_of_leaf(leaf)
|
||||
|
||||
if node is None:
|
||||
return []
|
||||
|
||||
@@ -453,7 +453,7 @@ class Evaluator(object):
|
||||
elif def_.type in ('import_from', 'import_name'):
|
||||
return imports.ImportWrapper(self, name).follow()
|
||||
|
||||
call = helpers.call_of_name(name)
|
||||
call = helpers.call_of_leaf(name)
|
||||
return self.eval_element(call)
|
||||
|
||||
def goto(self, name):
|
||||
@@ -514,7 +514,7 @@ class Evaluator(object):
|
||||
|
||||
scope = name.get_parent_scope()
|
||||
if tree.is_node(name.parent, 'trailer'):
|
||||
call = helpers.call_of_name(name, cut_own_trailer=True)
|
||||
call = helpers.call_of_leaf(name, cut_own_trailer=True)
|
||||
types = self.eval_element(call)
|
||||
return resolve_implicit_imports(iterable.unite(
|
||||
self.find_types(typ, name, is_goto=True) for typ in types
|
||||
|
||||
@@ -485,7 +485,7 @@ def _check_isinstance_type(evaluator, element, search_name):
|
||||
# Do a simple get_code comparison. They should just have the same code,
|
||||
# and everything will be all right.
|
||||
classes = lst[1][1][0]
|
||||
call = helpers.call_of_name(search_name)
|
||||
call = helpers.call_of_leaf(search_name)
|
||||
assert name.get_code(normalized=True) == call.get_code(normalized=True)
|
||||
except AssertionError:
|
||||
return set()
|
||||
|
||||
@@ -67,7 +67,7 @@ def deep_ast_copy(obj, parent=None, new_elements=None):
|
||||
return new_obj
|
||||
|
||||
|
||||
def call_of_name(leaf, cut_own_trailer=False):
|
||||
def call_of_leaf(leaf, cut_own_trailer=False):
|
||||
"""
|
||||
Creates a "call" node that consist of all ``trailer`` and ``power``
|
||||
objects. E.g. if you call it with ``append``::
|
||||
|
||||
@@ -716,7 +716,7 @@ def _check_array_additions(evaluator, compare_array, module, is_list):
|
||||
or execution_trailer.children[0] != '(' \
|
||||
or execution_trailer.children[1] == ')':
|
||||
continue
|
||||
power = helpers.call_of_name(name, cut_own_trailer=True)
|
||||
power = helpers.call_of_leaf(name, cut_own_trailer=True)
|
||||
# InstanceElements are special, because they don't get copied,
|
||||
# but have this wrapper around them.
|
||||
if isinstance(comp_arr_parent, er.InstanceElement):
|
||||
|
||||
@@ -4,7 +4,7 @@ from jedi import names
|
||||
from jedi.evaluate import helpers
|
||||
|
||||
|
||||
def test_call_of_name_in_brackets():
|
||||
def test_call_of_leaf_in_brackets():
|
||||
s = dedent("""
|
||||
x = 1
|
||||
type(x)
|
||||
@@ -12,5 +12,5 @@ def test_call_of_name_in_brackets():
|
||||
last_x = names(s, references=True, definitions=False)[-1]
|
||||
name = last_x._name
|
||||
|
||||
call = helpers.call_of_name(name)
|
||||
call = helpers.call_of_leaf(name)
|
||||
assert call == name
|
||||
|
||||
Reference in New Issue
Block a user