Regularize "or" so args are in 1..2 and ...

correct "return None" semantic action
This commit is contained in:
rocky
2020-05-18 22:54:08 -04:00
parent d7c3b8454b
commit 7fa851765d
3 changed files with 5 additions and 3 deletions

2
test/.gitignore vendored
View File

@@ -2,5 +2,7 @@
/.python-version /.python-version
/nohup.out /nohup.out
/pycdc /pycdc
/test_pycdc_tests.sh
/test_uncompyle2.py
/test_unpy33.py /test_unpy33.py
/test_unpy37.py /test_unpy37.py

View File

@@ -956,8 +956,8 @@ class Python37Parser(Python37BaseParser):
and ::= expr JUMP_IF_FALSE_OR_POP expr come_from_opt and ::= expr JUMP_IF_FALSE_OR_POP expr come_from_opt
and ::= expr jifop_come_from expr and ::= expr jifop_come_from expr
pjit_come_from ::= POP_JUMP_IF_TRUE COME_FROM expr_pjit_come_from ::= expr POP_JUMP_IF_TRUE COME_FROM
or ::= expr pjit_come_from expr or ::= expr_pjit_come_from expr
## Note that "jmp_false" is what we check on in the "and" reduce rule. ## Note that "jmp_false" is what we check on in the "and" reduce rule.
and ::= expr jmp_false expr COME_FROM and ::= expr jmp_false expr COME_FROM

View File

@@ -516,7 +516,7 @@ class SourceWalker(GenericASTTraversal, object):
if self.return_none or not self.is_return_none(node): if self.return_none or not self.is_return_none(node):
self.default(node) self.default(node)
else: else:
self.template_engine(("return\n"), node) self.template_engine(("%|return\n",), node)
self.prune() # stop recursing self.prune() # stop recursing