mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-26 08:47:58 +08:00
Fix flow's AttributeError detection.
This commit is contained in:
@@ -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