diff --git a/jedi/evaluate/helpers.py b/jedi/evaluate/helpers.py index dba8a868..abdf22b3 100644 --- a/jedi/evaluate/helpers.py +++ b/jedi/evaluate/helpers.py @@ -10,7 +10,7 @@ def fast_parent_copy(obj, new_elements_default=None): Much, much faster than copy.deepcopy, but just for certain elements. """ new_elements = new_elements_default or {} - accept = (pr.Simple, pr.NamePart) + accept = (pr.Simple, pr.NamePart, pr.KeywordStatement) def recursion(obj): if isinstance(obj, pr.Statement): diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index b10127fd..8d506fb0 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -537,9 +537,12 @@ class FunctionExecution(Executed): continue check = flow_analysis.break_check(self._evaluator, self, r.parent) - if check is not flow_analysis.UNREACHABLE: + if check is flow_analysis.UNREACHABLE: + debug.dbg('Return unreachable: %s', r) + else: types += self._evaluator.eval_statement(stmt) if check is flow_analysis.REACHABLE: + debug.dbg('Return reachable: %s', r) break return types @@ -594,8 +597,6 @@ class FunctionExecution(Executed): @memoize_default() def _scope_copy(self, scope): """ Copies a scope (e.g. if) in an execution """ - # TODO method uses different scopes than the subscopes property. - # just check the start_pos, sometimes it's difficult with closures # to compare the scopes directly. if scope.start_pos == self.start_pos: