Handle 3.0 call_stmt better

This commit is contained in:
rocky
2019-11-16 15:21:59 -05:00
parent dbf2729f76
commit d21d93fd84
3 changed files with 4 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ class Python30Parser(Python31Parser):
assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 COME_FROM POP_TOP
assert2 ::= assert_expr jmp_true LOAD_ASSERT expr CALL_FUNCTION_1 RAISE_VARARGS_1
come_froms
call_stmt ::= expr _come_froms POP_TOP
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM POP_TOP
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF_LAMBDA
@@ -158,7 +159,7 @@ class Python30Parser(Python31Parser):
ifnotstmt30 ::= testtrue_then _ifstmts_jump30
testfalse_then ::= expr jmp_false_then
testtrue_then ::= expr jmp_true_then
testtrue_then ::= expr jmp_true_then
call_stmt ::= expr COME_FROM
_ifstmts_jump30 ::= c_stmts POP_TOP

View File

@@ -40,6 +40,7 @@ def customize_for_version26_27(self, version):
'testtrue_then': ( 'not %p', (0, 22) ),
})
# FIXME: this should be a transformation
def n_call(node):
mapping = self._get_mapping(node)
key = node

View File

@@ -790,7 +790,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
self.name = code_name
# Issue created with later Python code generation is that there
# is a lamda set up with a dummy argument name that is then called
# is a lambda set up with a dummy argument name that is then called
# So we can't just translate that as is but need to replace the
# dummy name. Below we are picking out the variable name as seen
# in the code. And trying to generate code for the other parts