forked from VimPlug/jedi
don't raise attribute NameErrors in all for loop name definitions.
This commit is contained in:
@@ -595,7 +595,8 @@ class Script(object):
|
|||||||
nested_resolve=True).follow()
|
nested_resolve=True).follow()
|
||||||
if stmt.is_nested() and any(not isinstance(i, pr.Module) for i in imps):
|
if stmt.is_nested() and any(not isinstance(i, pr.Module) for i in imps):
|
||||||
analysis.add(self._evaluator, 'import-error', stmt)
|
analysis.add(self._evaluator, 'import-error', stmt)
|
||||||
else:
|
elif not (isinstance(stmt.parent, pr.ForFlow)
|
||||||
|
and stmt.parent.set_stmt == stmt):
|
||||||
self._evaluator.eval_statement(stmt)
|
self._evaluator.eval_statement(stmt)
|
||||||
|
|
||||||
ana = [a for a in self._evaluator.analysis if self.path == a.path]
|
ana = [a for a in self._evaluator.analysis if self.path == a.path]
|
||||||
|
|||||||
@@ -43,3 +43,10 @@ c.something = None
|
|||||||
#! name-error
|
#! name-error
|
||||||
something = a
|
something = a
|
||||||
something
|
something
|
||||||
|
|
||||||
|
|
||||||
|
# should not raise anything.
|
||||||
|
for loop_variable in [1, 2]:
|
||||||
|
#! name-error
|
||||||
|
x = undefined
|
||||||
|
loop_variable
|
||||||
|
|||||||
Reference in New Issue
Block a user