1
0
forked from VimPlug/jedi

Replace the get_iterator_types function with a different interface, which enables Jedi to detect invalid for loop inputs that are not iterable.

This commit is contained in:
Dave Halter
2015-09-22 19:18:36 +02:00
parent 786217acad
commit 22da402a7a
4 changed files with 18 additions and 21 deletions
+2 -7
View File
@@ -300,13 +300,8 @@ class NameFinder(object):
def _name_to_types(evaluator, name, scope):
types = []
typ = name.get_definition()
if typ.isinstance(tree.ForStmt):
for_types = evaluator.eval_element(typ.children[3])
for_types = iterable.get_iterator_types(for_types)
types += check_tuple_assignments(for_types, name)
elif typ.isinstance(tree.CompFor):
for_types = evaluator.eval_element(typ.children[3])
for_types = iterable.get_iterator_types(for_types)
if typ.isinstance(tree.ForStmt, tree.CompFor):
for_types = iterable.get_iterator_types(evaluator, typ.children[3])
types += check_tuple_assignments(for_types, name)
elif isinstance(typ, tree.Param):
types += _eval_param(evaluator, typ, scope)