Fix 3.5 misclassifying RETURN_VALUE

We use location of SETUP_EXCEPT instructions to disambiguate.
This commit is contained in:
rocky
2016-07-29 08:56:23 -04:00
parent 152935ab26
commit 3a6f9d8f24
5 changed files with 30 additions and 13 deletions

View File

@@ -739,11 +739,6 @@ class SourceWalker(GenericASTTraversal, object):
if self.return_none or node != AST('return_stmt', [AST('ret_expr', [NONE]), Token('RETURN_VALUE')]):
self.write(' ')
self.preorder(node[0])
# 3.5 does jump optimization. The RETURN_END_IF in the return
# statement means to dedent. Earlier versions will just have
# RETURN_VALUE it is done by a nonterminal in the grammar.
if self.version >= 3.5 and node[-1] == 'RETURN_END_IF':
self.indentLess()
self.println()
self.prune() # stop recursing