returns -> iter_return_stmts

This commit is contained in:
Dave Halter
2017-04-30 01:45:59 +02:00
parent b4039872bd
commit 606871eb62
2 changed files with 3 additions and 6 deletions

View File

@@ -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))

View File

@@ -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)