mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-16 08:56:44 +08:00
Fix flow's AttributeError detection.
This commit is contained in:
@@ -632,7 +632,7 @@ class Script(object):
|
||||
if node.type == 'expr_stmt':
|
||||
check_types(self._evaluator.eval_statement(node))
|
||||
else:
|
||||
self._evaluator.eval_element(node)
|
||||
check_types(self._evaluator.eval_element(node))
|
||||
|
||||
for dec_func in decorated_funcs:
|
||||
er.Function(self._evaluator, dec_func).get_decorated_func()
|
||||
|
||||
@@ -220,16 +220,6 @@ def get_module_statements(module):
|
||||
def add_stmts(stmts):
|
||||
new = set()
|
||||
for stmt in stmts:
|
||||
if isinstance(stmt, pr.Flow):
|
||||
while stmt is not None:
|
||||
new |= add_stmts(stmt.inputs)
|
||||
stmt = stmt.next
|
||||
continue
|
||||
|
||||
stmt = stmt.stmt
|
||||
if stmt is None:
|
||||
continue
|
||||
|
||||
if stmt.type == 'expr_stmt':
|
||||
new.add(stmt)
|
||||
|
||||
@@ -250,6 +240,10 @@ def get_module_statements(module):
|
||||
nodes |= add_stmts(scope.statements)
|
||||
nodes |= add_stmts(r for r in scope.returns if r is not None)
|
||||
|
||||
for flow in scope.flows:
|
||||
if flow.type == 'for_stmt':
|
||||
nodes.add(flow.children[3])
|
||||
|
||||
try:
|
||||
decorators = scope.get_decorators()
|
||||
except AttributeError:
|
||||
|
||||
Reference in New Issue
Block a user