diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 1359b15c..20f3d828 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -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() diff --git a/jedi/evaluate/analysis.py b/jedi/evaluate/analysis.py index 8dacb984..a9a68dca 100644 --- a/jedi/evaluate/analysis.py +++ b/jedi/evaluate/analysis.py @@ -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: