diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 824ff958..d0a19fd6 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -321,7 +321,7 @@ class FunctionExecutionContext(context.TreeContext): types = set() returns = funcdef.yields else: - returns = funcdef.returns + returns = funcdef.iter_return_stmts() types = set(docstrings.infer_return_types(self.function_context)) types |= set(pep0484.infer_return_types(self.function_context)) diff --git a/jedi/parser/python/tree.py b/jedi/parser/python/tree.py index a31a0330..564f4fc0 100644 --- a/jedi/parser/python/tree.py +++ b/jedi/parser/python/tree.py @@ -239,11 +239,8 @@ class Scope(PythonBaseNode, DocstringMixin): def __init__(self, children): super(Scope, self).__init__(children) - @property - def returns(self): - # Needed here for fast_parser, because the fast_parser splits and - # returns will be in "normal" modules. - return list(self._search_in_scope(ReturnStmt)) + def iter_return_stmts(self): + return self._search_in_scope(ReturnStmt) def iter_funcdefs(self): return self._search_in_scope(Function)