mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-11 00:01:54 +08:00
fix for a problem with get_in_function_call, if parentheses were not closed.
This commit is contained in:
@@ -202,6 +202,7 @@ def generate_param_array(args_tuple, parent_stmt=None):
|
||||
def scan_array_for_pos(arr, pos):
|
||||
"""
|
||||
Returns the function Call that match search_name in an Array.
|
||||
Makes changes to arr!
|
||||
"""
|
||||
def check_arr_index():
|
||||
positions = arr.arr_el_pos
|
||||
|
||||
@@ -1027,6 +1027,7 @@ class Array(Call):
|
||||
if self.type in (Array.LIST, Array.TUPLE):
|
||||
return # these are basically code errors, just ignore
|
||||
self.keys.append(self.values.pop())
|
||||
if self.type == Array.DICT:
|
||||
self.type = Array.DICT
|
||||
self.values.append([])
|
||||
|
||||
|
||||
@@ -208,6 +208,24 @@ class TestRegression(Base):
|
||||
"func(alpha='101',"
|
||||
assert check(self.get_in_function_call(s, (2, 13)), 'func', 0)
|
||||
|
||||
def test_get_in_function_call_complex(self):
|
||||
def check(call_def, name, index):
|
||||
return call_def and call_def.call_name == name \
|
||||
and call_def.index == index
|
||||
|
||||
s = """
|
||||
def abc(a,b):
|
||||
pass
|
||||
|
||||
def a(self):
|
||||
abc(
|
||||
|
||||
if 1:
|
||||
pass
|
||||
"""
|
||||
assert check(self.get_in_function_call(s, (6, 24)), 'abc', 0)
|
||||
|
||||
|
||||
def test_add_dynamic_mods(self):
|
||||
api.settings.additional_dynamic_modules = ['dynamic.py']
|
||||
# Fictional module that defines a function.
|
||||
|
||||
Reference in New Issue
Block a user