mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 15:24:46 +08:00
Fix the remaining issues with the StatementElement.next refactoring.
This commit is contained in:
@@ -106,9 +106,10 @@ def call_signature_array_for_pos(stmt, pos):
|
||||
|
||||
def search_call(call, pos, origin_call=None):
|
||||
tup = None, 0, None
|
||||
if call.next is not None:
|
||||
while call.next is not None and tup[0] is None:
|
||||
method = search_array if isinstance(call.next, pr.Array) else search_call
|
||||
tup = method(call.next, pos, origin_call or call)
|
||||
call = call.next
|
||||
return tup
|
||||
|
||||
if stmt.start_pos >= pos >= stmt.end_pos:
|
||||
|
||||
@@ -24,6 +24,9 @@ class TestCallSignatures(TestCase):
|
||||
|
||||
def test_simple(self):
|
||||
run = self._run_simple
|
||||
s7 = "str().upper().center("
|
||||
s8 = "str(int[zip("
|
||||
run(s7, 'center', 0)
|
||||
|
||||
# simple
|
||||
s1 = "sorted(a, str("
|
||||
|
||||
@@ -8,7 +8,7 @@ def parse_tree(statement_string, is_slice=False):
|
||||
stmt = p.module.statements[0]
|
||||
if is_slice:
|
||||
# get the part of the execution that is the slice
|
||||
stmt = stmt.expression_list()[0].execution[0]
|
||||
stmt = stmt.expression_list()[0].next[0]
|
||||
iterable = stmt.expression_list()
|
||||
pr = precedence.create_precedence(iterable)
|
||||
if isinstance(pr, precedence.Precedence):
|
||||
|
||||
@@ -104,7 +104,7 @@ class TestRegression(TestCase):
|
||||
parser = Parser(s)
|
||||
for i, s in enumerate(parser.module.statements, 3):
|
||||
for c in s.expression_list():
|
||||
self.assertEqual(c.execution.end_pos[1], i)
|
||||
self.assertEqual(c.next.end_pos[1], i)
|
||||
|
||||
def check_definition_by_marker(self, source, after_cursor, names):
|
||||
r"""
|
||||
|
||||
Reference in New Issue
Block a user