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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user