1
0
forked from VimPlug/jedi

scan_array_for_pos -> search_function_call, which makes much more sense

This commit is contained in:
David Halter
2013-01-07 14:11:45 +01:00
parent d35cb1898d
commit 082db3fdbd
2 changed files with 7 additions and 9 deletions

View File

@@ -361,7 +361,7 @@ class Script(object):
return None, 0 return None, 0
ass = helpers.fast_parent_copy(user_stmt.get_assignment_calls()) ass = helpers.fast_parent_copy(user_stmt.get_assignment_calls())
call, index, stop = helpers.scan_array_for_pos(ass, self.pos, True) call, index, stop = helpers.search_function_call(ass, self.pos)
return call, index return call, index
def check_cache(): def check_cache():

View File

@@ -225,11 +225,10 @@ def array_for_pos(arr, pos):
return result, check_arr_index(result, pos) return result, check_arr_index(result, pos)
def scan_array_for_pos(arr, pos, overwrite_after=False): def search_function_call(arr, pos):
""" """
Returns the function Call that matches the position before `arr`. Returns the function Call that matches the position before `arr`.
This is somehow stupid, probably only the name of the function. This is somehow stupid, probably only the name of the function.
:param overwrite_after: Overwrite every statement after the found array.
""" """
call = None call = None
stop = False stop = False
@@ -237,7 +236,7 @@ def scan_array_for_pos(arr, pos, overwrite_after=False):
call = None call = None
for s in sub: for s in sub:
if isinstance(s, parsing.Array): if isinstance(s, parsing.Array):
new = scan_array_for_pos(s, pos, overwrite_after) new = search_function_call(s, pos)
if new[0] is not None: if new[0] is not None:
call, index, stop = new call, index, stop = new
if stop: if stop:
@@ -252,8 +251,8 @@ def scan_array_for_pos(arr, pos, overwrite_after=False):
end = s.execution.end_pos end = s.execution.end_pos
if s.execution.start_pos < pos and \ if s.execution.start_pos < pos and \
(None in end or pos < end): (None in end or pos < end):
c, index, stop = scan_array_for_pos( c, index, stop = search_function_call(
s.execution, pos, overwrite_after) s.execution, pos)
if stop: if stop:
return c, index, stop return c, index, stop
@@ -265,9 +264,8 @@ def scan_array_for_pos(arr, pos, overwrite_after=False):
parsing.Array.NOARRAY]: parsing.Array.NOARRAY]:
return start_s, index, False return start_s, index, False
if overwrite_after: reset.execution = None
reset.execution = None reset.next = None
reset.next = None
return c or start_s, index, True return c or start_s, index, True
s = s.next s = s.next