forked from VimPlug/jedi
better support for get_in_function_call
This commit is contained in:
@@ -408,12 +408,16 @@ class Script(object):
|
|||||||
# call should return without execution and
|
# call should return without execution and
|
||||||
# next
|
# next
|
||||||
reset = c or s
|
reset = c or s
|
||||||
|
if reset.execution.type not in \
|
||||||
|
[parsing.Array.TUPLE,
|
||||||
|
parsing.Array.NOARRAY]:
|
||||||
|
return start_s, index, False
|
||||||
|
|
||||||
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
|
||||||
#else:
|
|
||||||
#return call, index, stop
|
|
||||||
s = s.next
|
s = s.next
|
||||||
|
|
||||||
# The third return is just necessary for recursion inside, because
|
# The third return is just necessary for recursion inside, because
|
||||||
# it needs to know when to stop iterating.
|
# it needs to know when to stop iterating.
|
||||||
return call, index, stop
|
return call, index, stop
|
||||||
|
|||||||
@@ -976,8 +976,10 @@ class Array(Call):
|
|||||||
Only used for dictionaries, automatically adds the tokens added by now
|
Only used for dictionaries, automatically adds the tokens added by now
|
||||||
from the values to keys, because the parser works this way.
|
from the values to keys, because the parser works this way.
|
||||||
"""
|
"""
|
||||||
self.type = Array.DICT
|
if self.type in (Array.LIST, Array.TUPLE):
|
||||||
|
return # these are basically code errors, just ignore
|
||||||
self.keys.append(self.values.pop())
|
self.keys.append(self.values.pop())
|
||||||
|
self.type = Array.DICT
|
||||||
self.values.append([])
|
self.values.append([])
|
||||||
|
|
||||||
def get_only_subelement(self):
|
def get_only_subelement(self):
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ class TestRegression(unittest.TestCase):
|
|||||||
s5 = "abs(1,\nif 2:\n def a():"
|
s5 = "abs(1,\nif 2:\n def a():"
|
||||||
s6 = "str().center("
|
s6 = "str().center("
|
||||||
s7 = "str().upper().center("
|
s7 = "str().upper().center("
|
||||||
|
s8 = "str(int[zip("
|
||||||
|
|
||||||
assert check(self.get_in_function_call(s, (1, 4)), 'abs', 0)
|
assert check(self.get_in_function_call(s, (1, 4)), 'abs', 0)
|
||||||
assert check(self.get_in_function_call(s, (1, 6)), 'abs', 1)
|
assert check(self.get_in_function_call(s, (1, 6)), 'abs', 1)
|
||||||
@@ -153,6 +154,8 @@ class TestRegression(unittest.TestCase):
|
|||||||
assert check(self.get_in_function_call(s6, (1, 4)), 'str', 0)
|
assert check(self.get_in_function_call(s6, (1, 4)), 'str', 0)
|
||||||
|
|
||||||
assert check(self.get_in_function_call(s7), 'center', 0)
|
assert check(self.get_in_function_call(s7), 'center', 0)
|
||||||
|
assert check(self.get_in_function_call(s8), 'zip', 0)
|
||||||
|
assert check(self.get_in_function_call(s8, (1, 8)), 'str', 0)
|
||||||
|
|
||||||
def test_add_dynamic_mods(self):
|
def test_add_dynamic_mods(self):
|
||||||
api.settings.additional_dynamic_modules = ['dynamic.py']
|
api.settings.additional_dynamic_modules = ['dynamic.py']
|
||||||
|
|||||||
Reference in New Issue
Block a user