forked from VimPlug/jedi
for flows triggered an exception if goto_assignments was used on the keyword. found with the help of sith.py
This commit is contained in:
@@ -266,6 +266,9 @@ class Script(object):
|
|||||||
stmt = r.module.statements[-1]
|
stmt = r.module.statements[-1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise NotFoundError()
|
raise NotFoundError()
|
||||||
|
if isinstance(stmt, pr.Flow):
|
||||||
|
raise NotFoundError()
|
||||||
|
|
||||||
user_stmt = self._parser.user_stmt()
|
user_stmt = self._parser.user_stmt()
|
||||||
if user_stmt is None:
|
if user_stmt is None:
|
||||||
# Set the start_pos to a pseudo position, that doesn't exist but works
|
# Set the start_pos to a pseudo position, that doesn't exist but works
|
||||||
|
|||||||
@@ -679,13 +679,15 @@ class ForFlow(Flow):
|
|||||||
super(ForFlow, self).__init__(module, 'for', inputs, start_pos)
|
super(ForFlow, self).__init__(module, 'for', inputs, start_pos)
|
||||||
|
|
||||||
self.set_stmt = set_stmt
|
self.set_stmt = set_stmt
|
||||||
set_stmt.parent = self.use_as_parent
|
|
||||||
self.is_list_comp = is_list_comp
|
self.is_list_comp = is_list_comp
|
||||||
|
|
||||||
self.set_vars = set_stmt.get_defined_names()
|
if set_stmt is not None:
|
||||||
for s in self.set_vars:
|
set_stmt.parent = self.use_as_parent
|
||||||
s.parent.parent = self.use_as_parent
|
self.set_vars = set_stmt.get_defined_names()
|
||||||
s.parent = self.use_as_parent
|
|
||||||
|
for s in self.set_vars:
|
||||||
|
s.parent.parent = self.use_as_parent
|
||||||
|
s.parent = self.use_as_parent
|
||||||
|
|
||||||
def get_code(self, first_indent=False, indention=" " * 4):
|
def get_code(self, first_indent=False, indention=" " * 4):
|
||||||
vars = ",".join(x.get_code() for x in self.set_vars)
|
vars = ",".join(x.get_code() for x in self.set_vars)
|
||||||
|
|||||||
@@ -94,3 +94,8 @@ def test_completion_on_complex_literals():
|
|||||||
_check_number('4.0j.', 'complex')
|
_check_number('4.0j.', 'complex')
|
||||||
# No dot no completion
|
# No dot no completion
|
||||||
assert api.Script('4j').completions() == []
|
assert api.Script('4j').completions() == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_goto_assignments_on_for():
|
||||||
|
with raises(api.NotFoundError):
|
||||||
|
api.Script('for').goto_assignments()
|
||||||
|
|||||||
Reference in New Issue
Block a user