Return statements should be handled correctly if the return_stmt is only a return without an expression behind it.

This commit is contained in:
Dave Halter
2017-09-02 14:03:54 +02:00
parent c47f5ca68c
commit 9cac7462d6
2 changed files with 12 additions and 1 deletions

View File

@@ -335,7 +335,12 @@ class FunctionExecutionContext(context.TreeContext):
if check_yields:
types |= set(self._eval_yield(r))
else:
types |= self.eval_node(r.children[1])
try:
children = r.children
except AttributeError:
types.add(compiled.create(self.evaluator, None))
else:
types |= self.eval_node(children[1])
if check is flow_analysis.REACHABLE:
debug.dbg('Return reachable: %s', r)
break

View File

@@ -1,3 +1,9 @@
def x():
return
#? None
x()
def array(first_param):
#? ['first_param']
first_param