mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-17 13:59:37 +08:00
Fix flow's AttributeError detection.
This commit is contained in:
@@ -632,7 +632,7 @@ class Script(object):
|
|||||||
if node.type == 'expr_stmt':
|
if node.type == 'expr_stmt':
|
||||||
check_types(self._evaluator.eval_statement(node))
|
check_types(self._evaluator.eval_statement(node))
|
||||||
else:
|
else:
|
||||||
self._evaluator.eval_element(node)
|
check_types(self._evaluator.eval_element(node))
|
||||||
|
|
||||||
for dec_func in decorated_funcs:
|
for dec_func in decorated_funcs:
|
||||||
er.Function(self._evaluator, dec_func).get_decorated_func()
|
er.Function(self._evaluator, dec_func).get_decorated_func()
|
||||||
|
|||||||
@@ -220,16 +220,6 @@ def get_module_statements(module):
|
|||||||
def add_stmts(stmts):
|
def add_stmts(stmts):
|
||||||
new = set()
|
new = set()
|
||||||
for stmt in stmts:
|
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':
|
if stmt.type == 'expr_stmt':
|
||||||
new.add(stmt)
|
new.add(stmt)
|
||||||
|
|
||||||
@@ -250,6 +240,10 @@ def get_module_statements(module):
|
|||||||
nodes |= add_stmts(scope.statements)
|
nodes |= add_stmts(scope.statements)
|
||||||
nodes |= add_stmts(r for r in scope.returns if r is not None)
|
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:
|
try:
|
||||||
decorators = scope.get_decorators()
|
decorators = scope.get_decorators()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user